Skip to content

Commit b449602

Browse files
committed
Implement provider mappings between OIDs and algorithm names
1 parent 486ac81 commit b449602

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/net/i2p/crypto/eddsa/EdDSASecurityProvider.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,22 @@ public Object run() {
3838
}
3939

4040
protected void setup() {
41-
// see https://docs.oracle.com/javase/8/docs/technotes/guides/security/crypto/HowToImplAProvider.html
42-
put("KeyPairGenerator." + EdDSAKey.KEY_ALGORITHM, "net.i2p.crypto.eddsa.KeyPairGenerator");
41+
// See https://docs.oracle.com/javase/8/docs/technotes/guides/security/crypto/HowToImplAProvider.html
4342
put("KeyFactory." + EdDSAKey.KEY_ALGORITHM, "net.i2p.crypto.eddsa.KeyFactory");
43+
put("KeyPairGenerator." + EdDSAKey.KEY_ALGORITHM, "net.i2p.crypto.eddsa.KeyPairGenerator");
4444
put("Signature." + EdDSAEngine.SIGNATURE_ALGORITHM, "net.i2p.crypto.eddsa.EdDSAEngine");
45+
46+
// OID Mappings
47+
// See section "Mapping from OID to name".
48+
// The Key* -> OID mappings correspond to the default algorithm in KeyPairGenerator.
49+
//
50+
// From draft-ieft-curdle-pkix-04:
51+
// id-Ed25519 OBJECT IDENTIFIER ::= { 1 3 101 112 }
52+
put("Alg.Alias.KeyFactory.1.3.101.112", EdDSAKey.KEY_ALGORITHM);
53+
put("Alg.Alias.KeyFactory.OID.1.3.101.112", EdDSAKey.KEY_ALGORITHM);
54+
put("Alg.Alias.KeyPairGenerator.1.3.101.112", EdDSAKey.KEY_ALGORITHM);
55+
put("Alg.Alias.KeyPairGenerator.OID.1.3.101.112", EdDSAKey.KEY_ALGORITHM);
56+
put("Alg.Alias.Signature.1.3.101.112", EdDSAEngine.SIGNATURE_ALGORITHM);
57+
put("Alg.Alias.Signature.OID.1.3.101.112", EdDSAEngine.SIGNATURE_ALGORITHM);
4558
}
4659
}

0 commit comments

Comments
 (0)