private byte[] decodeText(OMElement e) { return Base64.decode(e.getText()); }
private static String decryptDS(Cipher cipher, String encryptedDS) throws Exception { return new String(cipher.doFinal(Base64.decode(encryptedDS)), StandardCharsets.UTF_8); }
private String[] getUserPassword(String authHeader) { if (authHeader == null) { return null; } if (!authHeader.startsWith("Basic ")) { return null; } String[] userPassword = new String(Base64.decode(authHeader.substring(6)), StandardCharsets.UTF_8).split(":"); if (userPassword.length != 2) { return null; } return userPassword; }
public void addKeyStore(String fileData, String filename, String password, String provider, String type, String pvtkeyPass) throws SecurityConfigException { byte[] content = Base64.decode(fileData); addKeyStore(content, filename, password, provider, type, pvtkeyPass); }
private static Cipher initializeCipher() throws Exception { String keyAlias = System.getProperty(SYS_PROPERTY_KEY_ALIAS); String keyPass = System.getProperty(SYS_PROPERTY_KEY_PASS); String keyStore = System.getProperty(SYS_PROPERTY_KEY_STORE); String keyStorePassword = System.getProperty(SYS_PROPERTY_KEY_STORE_PASSWORD); byte[] iv = Base64.decode(System.getProperty(SYS_PROPERTY_IV)); return initializeBasicCipher(keyAlias, keyPass, keyStore, keyStorePassword, iv); }
public void addTrustStore(String fileData, String filename, String password, String provider, String type) throws SecurityConfigException { byte[] content = Base64.decode(fileData); addTrustStore(content, filename, password, provider, type); }
public void addTrustStore(String fileData, String filename, String password, String provider, String type) throws SecurityConfigException { byte[] content = Base64.decode(fileData); addTrustStore(content, filename, password, provider, type); }
public void addKeyStore(String fileData, String filename, String password, String provider, String type, String pvtkeyPass) throws SecurityConfigException { byte[] content = Base64.decode(fileData); addKeyStore(content, filename, password, provider, type, pvtkeyPass); }
public void addKeyStore(String fileData, String filename, String password, String provider, String type, String pvtkeyPass) throws SecurityConfigException { byte[] content = Base64.decode(fileData); addKeyStore(content, filename, password, provider, type, pvtkeyPass); }
public void addTrustStore(String fileData, String filename, String password, String provider, String type) throws SecurityConfigException { byte[] content = Base64.decode(fileData); addTrustStore(content, filename, password, provider, type); }
private static CertData createCertData(String encodedCert) throws CertificateException { byte[] bytes = Base64.decode(encodedCert); CertificateFactory factory = CertificateFactory.getInstance(IdentityApplicationConstants.CERTIFICATE_TYPE); X509Certificate cert = (X509Certificate) factory .generateCertificate(new ByteArrayInputStream(bytes)); Format formatter = new SimpleDateFormat(IdentityApplicationConstants.DATE_FORMAT); return fillCertData(cert, formatter); }
private static String handleCertificateDeletion(String oldCertificateValues, String deletedCertificateValues) { String decodedOldCertificate = new String(Base64.decode(oldCertificateValues)); String decodedDeletedCertificate = new String(Base64.decode(deletedCertificateValues)); Set<String> updatedCertificateSet = new LinkedHashSet<>(getExtractedCertificateValues(decodedOldCertificate)); updatedCertificateSet.removeAll(getExtractedCertificateValues(decodedDeletedCertificate)); return Base64.encode(String.join("", updatedCertificateSet).getBytes(StandardCharsets.UTF_8)); }
private static String handleCertificateDeletion(String oldCertificateValues, String deletedCertificateValues) { String decodedOldCertificate = new String(Base64.decode(oldCertificateValues)); String decodedDeletedCertificate = new String(Base64.decode(deletedCertificateValues)); Set<String> updatedCertificateSet = new LinkedHashSet<>(getExtractedCertificateValues(decodedOldCertificate)); updatedCertificateSet.removeAll(getExtractedCertificateValues(decodedDeletedCertificate)); return Base64.encode(String.join("", updatedCertificateSet).getBytes(StandardCharsets.UTF_8)); }
/** * * Converts and returns a {@link Certificate} object for given PEM content. * * @param certificateContent * @return * @throws CertificateException */ public static Certificate convertPEMEncodedContentToCertificate(String certificateContent) throws CertificateException { certificateContent = getCertificateString(certificateContent); byte[] bytes = org.apache.axiom.om.util.Base64.decode(certificateContent); CertificateFactory factory = CertificateFactory.getInstance("X.509"); X509Certificate certificate = (X509Certificate) factory.generateCertificate(new ByteArrayInputStream(bytes)); return certificate; }
private static String handleCertificateAddition(String oldCertValues, String newCertValues) { String decodedOldCertificate = new String(Base64.decode(oldCertValues)); String decodedNewCertificate = new String(Base64.decode(newCertValues)); Set<String> updatedCertificateSet = new LinkedHashSet<>(getExtractedCertificateValues (decodedOldCertificate)); updatedCertificateSet.addAll(getExtractedCertificateValues(decodedNewCertificate)); return Base64.encode(String.join("", updatedCertificateSet).getBytes(StandardCharsets.UTF_8)); }
/** * @param encodedCert * @return * @throws CertificateException */ public static CertData getCertData(String encodedCert) throws CertificateException { if (encodedCert != null) { byte[] bytes = Base64.decode(encodedCert); CertificateFactory factory = CertificateFactory.getInstance("X.509"); X509Certificate cert = (X509Certificate) factory .generateCertificate(new ByteArrayInputStream(bytes)); Format formatter = new SimpleDateFormat("dd/MM/yyyy"); return fillCertData(cert, formatter); } else { String errorMsg = "Invalid encoded certificate: \'NULL\'"; log.debug(errorMsg); throw new IllegalArgumentException(errorMsg); } }
private static String handleCertificateAddition(String oldCertValues, String newCertValues) { String decodedOldCertificate = new String(Base64.decode(oldCertValues)); String decodedNewCertificate = new String(Base64.decode(newCertValues)); Set<String> updatedCertificateSet = new LinkedHashSet<>(getExtractedCertificateValues (decodedOldCertificate)); updatedCertificateSet.addAll(getExtractedCertificateValues(decodedNewCertificate)); return Base64.encode(String.join("", updatedCertificateSet).getBytes(StandardCharsets.UTF_8)); }
/** * * Converts and returns a {@link Certificate} object for given PEM content. * * @param certificateContent * @return * @throws CertificateException */ public static Certificate convertPEMEncodedContentToCertificate(String certificateContent) throws CertificateException { certificateContent = getCertificateString(certificateContent); byte[] bytes = org.apache.axiom.om.util.Base64.decode(certificateContent); CertificateFactory factory = CertificateFactory.getInstance("X.509"); X509Certificate certificate = (X509Certificate) factory.generateCertificate(new ByteArrayInputStream(bytes)); return certificate; }
public BasicAuthInfo decodeBasicAuthHeader(String authorizationHeader) { byte[] decodedAuthHeader = Base64.decode(authorizationHeader.split(" ")[1]); String authHeader = new String(decodedAuthHeader); String userName = authHeader.split(":")[0]; String password = authHeader.split(":")[1]; BasicAuthInfo basicAuthInfo = new BasicAuthInfo(); basicAuthInfo.setUserName(userName); basicAuthInfo.setPassword(password); return basicAuthInfo; }
private byte[] getSKIValue(KeyBindingAbstractType abstractType) { List useKeyWiths = abstractType.getUseKeyWith(); if (useKeyWiths == null || useKeyWiths.isEmpty()) { return null; } for (Iterator iterator = useKeyWiths.iterator(); iterator.hasNext();) { UseKeyWith useKeyWith = (UseKeyWith) iterator.next(); if (UseKeyWith.SKI.equals(useKeyWith.getApplication())) { return Base64.decode(useKeyWith.getIdentifier()); } } return null; }