com.fitbur.bouncycastle.asn1.test.SubjectKeyIdentifierTest Maven / Gradle / Ivy
package com.fitbur.bouncycastle.asn1.test;
import java.io.IOException;
import com.fitbur.bouncycastle.util.encoders.Base64;
import com.fitbur.bouncycastle.util.encoders.Hex;
import com.fitbur.bouncycastle.util.test.SimpleTest;
public class SubjectKeyIdentifierTest
extends SimpleTest
{
private static byte[] pubKeyInfo = Base64.com.fitburcode(
"MFgwCwYJKoZIhvcNAQEBA0kAMEYCQQC6wMMmHYMZszT/7bNFMn+gaZoiWJLVP8ODRuu1C2jeAe" +
"QpxM+5Oe7PaN2GNy3nBE4EOYkB5pMJWA0y9n04FX8NAgED");
private static byte[] shaID = Hex.com.fitburcode("d8128a06d6c2feb0865994a2936e7b75b836a021");
private static byte[] shaTruncID = Hex.com.fitburcode("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());
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy