/** * Returns OID for algName * * @param algName algorithm name to be mapped * @return OID as String */ public static String map2OID(String algName) { checkCacheVersion(); // alg2OidMap map contains upper case keys String result = alg2OidMap.get(algName.toUpperCase(Locale.US)); if (result != null) { return result; } // Check our external source. AlgNameMapperSource s = source; if (s != null) { return s.mapNameToOid(algName); } return null; }
private boolean mapAlgName() { if (AlgNameMapper.isOID(this.algName)) { this.oid = AlgNameMapper.normalize(this.algName); this.algName = AlgNameMapper.map2AlgName(this.oid); String stdName = AlgNameMapper.getStandardName(this.algName); this.oid = AlgNameMapper.map2OID(this.algName); if (this.oid == null) { if (stdName == null) { this.oid = AlgNameMapper.map2OID(stdName); if (this.oid == null) { return false;
private static synchronized void checkCacheVersion() { int newCacheVersion = Services.getCacheVersion(); if (newCacheVersion != cacheVersion) { // // Now search providers for mappings like // Alg.Alias.<service>.<OID-INTS-DOT-SEPARATED>=<alg-name> // or // Alg.Alias.<service>.OID.<OID-INTS-DOT-SEPARATED>=<alg-name> // Provider[] pl = Security.getProviders(); for (Provider element : pl) { selectEntries(element); } cacheVersion = newCacheVersion; } }
/** * Returns the name of the algorithm corresponding to * its OID. If there is no the such correspondence, * algorithm OID is returned. */ public String getAlgorithmName() { if (algorithmName == null) { algorithmName = AlgNameMapper.map2AlgName(algorithm); if (algorithmName == null) { algorithmName = algorithm; } } return algorithmName; }
/** * Creates object from DSAPublicKeySpec. * * @param keySpec - a DSAPublicKeySpec object */ public DSAPublicKeyImpl(DSAPublicKeySpec keySpec) { super("DSA"); SubjectPublicKeyInfo spki; p = keySpec.getP(); q = keySpec.getQ(); g = keySpec.getG(); ThreeIntegerSequence threeInts = new ThreeIntegerSequence(p .toByteArray(), q.toByteArray(), g.toByteArray()); AlgorithmIdentifier ai = new AlgorithmIdentifier(AlgNameMapper .map2OID("DSA"), threeInts.getEncoded()); y = keySpec.getY(); spki = new SubjectPublicKeyInfo(ai, ASN1Integer.getInstance().encode( y.toByteArray())); setEncoding(spki.getEncoded()); params = (DSAParams) (new DSAParameterSpec(p, q, g)); }
/** * Checks if parameter represents OID * * @param alias alias to be checked * @return 'true' if parameter represents OID */ public static boolean isOID(String alias) { return ObjectIdentifier.isOID(normalize(alias)); }
String alg = (String)me.getValue(); String algUC = alg.toUpperCase(Locale.US); if (isOID(alias)) { if (alias.startsWith("OID.")) { alias = alias.substring(4);
private Platform() { AlgNameMapper.setSource(new OpenSSLMapper()); }
public String getSigAlgName() { String result = sigAlgName; if (result == null) { String sigAlgOIDLocal = getSigAlgOID(); // retrieve the name of the signing algorithm result = AlgNameMapper.map2AlgName(sigAlgOIDLocal); if (result == null) { // if could not be found, use OID as a name result = sigAlgOIDLocal; } sigAlgName = result; } return result; }
/** * Creates object from DSAPrivateKeySpec. * * @param keySpec - a DSAPrivateKeySpec object */ public DSAPrivateKeyImpl(DSAPrivateKeySpec keySpec) { super("DSA"); PrivateKeyInfo pki; g = keySpec.getG(); p = keySpec.getP(); q = keySpec.getQ(); ThreeIntegerSequence threeInts = new ThreeIntegerSequence(p .toByteArray(), q.toByteArray(), g.toByteArray()); AlgorithmIdentifier ai = new AlgorithmIdentifier(AlgNameMapper .map2OID("DSA"), threeInts.getEncoded()); x = keySpec.getX(); pki = new PrivateKeyInfo(0, ai, ASN1Integer.getInstance().encode( x.toByteArray()), null); setEncoding(pki.getEncoded()); params = new DSAParameterSpec(p, q, g); }
/** * Checks if parameter represents OID * * @param alias alias to be checked * @return 'true' if parameter represents OID */ public static boolean isOID(String alias) { return ObjectIdentifier.isOID(normalize(alias)); }
String alg = (String)me.getValue(); String algUC = alg.toUpperCase(Locale.US); if (isOID(alias)) { if (alias.startsWith("OID.")) { alias = alias.substring(4);
private Platform() { AlgNameMapper.setSource(new OpenSSLMapper()); }
private boolean mapAlgName() { if (AlgNameMapper.isOID(this.algName)) { this.oid = AlgNameMapper.normalize(this.algName); this.algName = AlgNameMapper.map2AlgName(this.oid); String stdName = AlgNameMapper.getStandardName(this.algName); this.oid = AlgNameMapper.map2OID(this.algName); if (this.oid == null) { if (stdName == null) { this.oid = AlgNameMapper.map2OID(stdName); if (this.oid == null) { return false;
/** * @see java.security.cert.X509CRL#getSigAlgName() * method documentation for more info */ public String getSigAlgName() { if (sigAlgOID == null) { sigAlgOID = tbsCertList.getSignature().getAlgorithm(); sigAlgName = AlgNameMapper.map2AlgName(sigAlgOID); if (sigAlgName == null) { sigAlgName = sigAlgOID; } } return sigAlgName; }
/** * Returns algName for OID * * @param oid OID to be mapped * @return algorithm name */ public static String map2AlgName(String oid) { checkCacheVersion(); // oid2AlgMap map contains upper case values String algUC = oid2AlgMap.get(oid); // if not null there is always map UC->Orig if (algUC != null) { return algAliasesMap.get(algUC); } // Check our external source. AlgNameMapperSource s = source; if (s != null) { return s.mapOidToName(oid); } return null; }
/** * Creates object from DSAPublicKeySpec. * * @param keySpec - a DSAPublicKeySpec object */ public DSAPublicKeyImpl(DSAPublicKeySpec keySpec) { super("DSA"); SubjectPublicKeyInfo spki; p = keySpec.getP(); q = keySpec.getQ(); g = keySpec.getG(); ThreeIntegerSequence threeInts = new ThreeIntegerSequence(p .toByteArray(), q.toByteArray(), g.toByteArray()); AlgorithmIdentifier ai = new AlgorithmIdentifier(AlgNameMapper .map2OID("DSA"), threeInts.getEncoded()); y = keySpec.getY(); spki = new SubjectPublicKeyInfo(ai, ASN1Integer.getInstance().encode( y.toByteArray())); setEncoding(spki.getEncoded()); params = (DSAParams) (new DSAParameterSpec(p, q, g)); }
/** * Checks if parameter represents OID * * @param alias alias to be checked * @return 'true' if parameter represents OID */ public static boolean isOID(String alias) { return ObjectIdentifier.isOID(normalize(alias)); }
private static synchronized void checkCacheVersion() { int newCacheVersion = Services.getCacheVersion(); if (newCacheVersion != cacheVersion) { // // Now search providers for mappings like // Alg.Alias.<service>.<OID-INTS-DOT-SEPARATED>=<alg-name> // or // Alg.Alias.<service>.OID.<OID-INTS-DOT-SEPARATED>=<alg-name> // Provider[] pl = Security.getProviders(); for (Provider element : pl) { selectEntries(element); } cacheVersion = newCacheVersion; } }
String alg = (String)me.getValue(); String algUC = alg.toUpperCase(Locale.US); if (isOID(alias)) { if (alias.startsWith("OID.")) { alias = alias.substring(4);