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fjvCCkpDZoa01gZhz5v6yAlGYuuUGK02XThIAC71AdXkbc98m6tTR8KvPG2F9fVJ3bTc0R5/0UAoNmXsimABKgX77OFP67H6dh96tK8QYUn8pJQsKpvO2FsauBQeYNxUJpU4c5nUwfAA4+Bw11V0SoU7Q2dmSZ3G7rPUZuFF1eR1ONeE3gJ7uOhXY="; CertificateToken rootCA2 = DSSUtils.loadCertificateFromBase64EncodedString(certBase64); logger.info(rootCA2.toString()); logger.info(rootCA2.getCertificate().toString()); assertTrue(rootCA2.isCA()); X509Certificate certificate = rootCA2.getCertificate(); certificate.verify(certificate.getPublicKey()); }
public static CertificateToken loadCertificateFromBase64EncodedString(final String base64Encoded) { final byte[] bytes = Utils.fromBase64(base64Encoded); return loadCertificate(bytes); }
DSSUtils { public static CertificateToken loadCertificateFromBase64EncodedString(final String base64Encoded) { final byte[] bytes = Utils.fromBase64(base64Encoded); return loadCertificate(bytes); } }
DSSUtils { public static CertificateToken loadCertificateFromBase64EncodedString(final String base64Encoded) { final byte[] bytes = Utils.fromBase64(base64Encoded); return loadCertificate(bytes); } private  DSSUtils(); }
DSSUtils { public static CertificateToken loadCertificateFromBase64EncodedString(final String base64Encoded) { final byte[] bytes = Utils.fromBase64(base64Encoded); return loadCertificate(bytes); } private  DSSUtils(); static String formatInternal(final Date date); static String formatDateWithCustomFormat(final Date date, final String format); static String toHex(final byte[] value); static String convertToPEM(final CertificateToken cert); static boolean isStartWithASN1SequenceTag(InputStream is); static byte[] convertToDER(String pemContent); static CertificateToken loadCertificate(final File file); static CertificateToken loadCertificate(final InputStream inputStream); static Collection<CertificateToken> loadCertificateFromP7c(InputStream is); static CertificateToken loadCertificate(final byte[] input); static CertificateToken loadCertificateFromBase64EncodedString(final String base64Encoded); static Collection<CertificateToken> loadPotentialIssuerCertificates(final CertificateToken cert, final DataLoader loader); static String getSHA1Digest(final String stringToDigest); static byte[] digest(final DigestAlgorithm digestAlgorithm, final byte[] data); static MessageDigest getMessageDigest(DigestAlgorithm digestAlgorithm); static byte[] encodeRSADigest(final DigestAlgorithm digestAlgorithm, final byte[] digest); static byte[] digest(final DigestAlgorithm digestAlgo, final InputStream inputStream); static byte[] digest(DigestAlgorithm digestAlgorithm, DSSDocument document); static byte[] digest(DigestAlgorithm digestAlgorithm, byte[]... data); static InputStream toInputStream(final File file); static InputStream toByteArrayInputStream(final File file); static byte[] toByteArray(final File file); static DSSDocument splitDocument(DSSDocument origin, int start, int end); static byte[] toByteArray(final DSSDocument document); static byte[] toByteArray(final InputStream inputStream); static CMSSignedData toCMSSignedData(final DSSDocument document); static boolean isTimestampToken(final DSSDocument document); static long getFileByteSize(DSSDocument dssDocument); static void saveToFile(final byte[] bytes, final File file); static String getNormalizedString(final String str); static String getDeterministicId(final Date signingTime, TokenIdentifier id); static String getMD5Digest(byte[] bytes); static X500Principal getX500PrincipalOrNull(final String x500PrincipalString); static Date getUtcDate(final int year, final int month, final int day); static void printSecurityProviders(); static byte readFirstByte(final DSSDocument dssDocument); static boolean compareFirstBytes(final DSSDocument dssDocument, byte[] byteArray); static byte[] concatenate(byte[]... arrays); static String decodeUrl(String uri); static long skipAvailableBytes(InputStream is, long n); static long readAvailableBytes(DSSDocument dssDocument, byte[] b); static long readAvailableBytes(InputStream is, byte[] b); static long readAvailableBytes(InputStream is, byte[] b, int off, int len); static String encodeURI(String fileURI); static String getExceptionMessage(Exception e); static Digest getDigest(DigestAlgorithm digestAlgo, DSSDocument dssDocument); static String removeControlCharacters(String str); }
DSSUtils { public static CertificateToken loadCertificateFromBase64EncodedString(final String base64Encoded) { final byte[] bytes = Utils.fromBase64(base64Encoded); return loadCertificate(bytes); } private  DSSUtils(); static String formatInternal(final Date date); static String formatDateWithCustomFormat(final Date date, final String format); static String toHex(final byte[] value); static String convertToPEM(final CertificateToken cert); static boolean isStartWithASN1SequenceTag(InputStream is); static byte[] convertToDER(String pemContent); static CertificateToken loadCertificate(final File file); static CertificateToken loadCertificate(final InputStream inputStream); static Collection<CertificateToken> loadCertificateFromP7c(InputStream is); static CertificateToken loadCertificate(final byte[] input); static CertificateToken loadCertificateFromBase64EncodedString(final String base64Encoded); static Collection<CertificateToken> loadPotentialIssuerCertificates(final CertificateToken cert, final DataLoader loader); static String getSHA1Digest(final String stringToDigest); static byte[] digest(final DigestAlgorithm digestAlgorithm, final byte[] data); static MessageDigest getMessageDigest(DigestAlgorithm digestAlgorithm); static byte[] encodeRSADigest(final DigestAlgorithm digestAlgorithm, final byte[] digest); static byte[] digest(final DigestAlgorithm digestAlgo, final InputStream inputStream); static byte[] digest(DigestAlgorithm digestAlgorithm, DSSDocument document); static byte[] digest(DigestAlgorithm digestAlgorithm, byte[]... data); static InputStream toInputStream(final File file); static InputStream toByteArrayInputStream(final File file); static byte[] toByteArray(final File file); static DSSDocument splitDocument(DSSDocument origin, int start, int end); static byte[] toByteArray(final DSSDocument document); static byte[] toByteArray(final InputStream inputStream); static CMSSignedData toCMSSignedData(final DSSDocument document); static boolean isTimestampToken(final DSSDocument document); static long getFileByteSize(DSSDocument dssDocument); static void saveToFile(final byte[] bytes, final File file); static String getNormalizedString(final String str); static String getDeterministicId(final Date signingTime, TokenIdentifier id); static String getMD5Digest(byte[] bytes); static X500Principal getX500PrincipalOrNull(final String x500PrincipalString); static Date getUtcDate(final int year, final int month, final int day); static void printSecurityProviders(); static byte readFirstByte(final DSSDocument dssDocument); static boolean compareFirstBytes(final DSSDocument dssDocument, byte[] byteArray); static byte[] concatenate(byte[]... arrays); static String decodeUrl(String uri); static long skipAvailableBytes(InputStream is, long n); static long readAvailableBytes(DSSDocument dssDocument, byte[] b); static long readAvailableBytes(InputStream is, byte[] b); static long readAvailableBytes(InputStream is, byte[] b, int off, int len); static String encodeURI(String fileURI); static String getExceptionMessage(Exception e); static Digest getDigest(DigestAlgorithm digestAlgo, DSSDocument dssDocument); static String removeControlCharacters(String str); static final byte[] EMPTY_BYTE_ARRAY; }