diff options
author | Roberto Tyley <roberto.tyley@gmail.com> | 2014-07-15 01:38:01 +0400 |
---|---|---|
committer | Roberto Tyley <roberto.tyley@gmail.com> | 2014-07-26 11:23:17 +0400 |
commit | 7cb752aaf746dc0b473afeb9e892b7fbc12666c5 (patch) | |
tree | cc4f91ddc18332b5adbe82e3fcb040d976c90105 /core/src/test/java/org/spongycastle/asn1/test/SubjectKeyIdentifierTest.java | |
parent | 551830f8ea5177042af2c7dd1fc90888bc67387d (diff) |
Execute become-spongy.sh
https://github.com/rtyley/spongycastle/blob/3040af/become-spongy.sh
Diffstat (limited to 'core/src/test/java/org/spongycastle/asn1/test/SubjectKeyIdentifierTest.java')
-rw-r--r-- | core/src/test/java/org/spongycastle/asn1/test/SubjectKeyIdentifierTest.java | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/core/src/test/java/org/spongycastle/asn1/test/SubjectKeyIdentifierTest.java b/core/src/test/java/org/spongycastle/asn1/test/SubjectKeyIdentifierTest.java new file mode 100644 index 00000000..3aba390b --- /dev/null +++ b/core/src/test/java/org/spongycastle/asn1/test/SubjectKeyIdentifierTest.java @@ -0,0 +1,48 @@ +package org.spongycastle.asn1.test; + +import java.io.IOException; + +import org.spongycastle.util.encoders.Base64; +import org.spongycastle.util.encoders.Hex; +import org.spongycastle.util.test.SimpleTest; + +public class SubjectKeyIdentifierTest + extends SimpleTest +{ + private static byte[] pubKeyInfo = Base64.decode( + "MFgwCwYJKoZIhvcNAQEBA0kAMEYCQQC6wMMmHYMZszT/7bNFMn+gaZoiWJLVP8ODRuu1C2jeAe" + + "QpxM+5Oe7PaN2GNy3nBE4EOYkB5pMJWA0y9n04FX8NAgED"); + + private static byte[] shaID = Hex.decode("d8128a06d6c2feb0865994a2936e7b75b836a021"); + private static byte[] shaTruncID = Hex.decode("436e7b75b836a021"); + + public String getName() + { + return "SubjectKeyIdentifier"; + } + + public void performTest() + throws IOException + { +// SubjectPublicKeyInfo pubInfo = SubjectPublicKeyInfo.getInstance(ASN1Primitive.fromByteArray(pubKeyInfo)); +// SubjectKeyIdentifier ski = SubjectKeyIdentifier.createSHA1KeyIdentifier(pubInfo); +// +// if (!Arrays.areEqual(shaID, ski.getKeyIdentifier())) +// { +// fail("SHA-1 ID does not match"); +// } +// +// ski = SubjectKeyIdentifier.createTruncatedSHA1KeyIdentifier(pubInfo); +// +// if (!Arrays.areEqual(shaTruncID, ski.getKeyIdentifier())) +// { +// fail("truncated SHA-1 ID does not match"); +// } + } + + public static void main( + String[] args) + { + runTest(new SubjectKeyIdentifierTest()); + } +} |