Methods Summary |
---|
private void | recodeCheck(java.lang.String oid, byte[] enc)
ByteArrayInputStream bIn = new ByteArrayInputStream(enc);
Asn1InputStream aIn = new Asn1InputStream(bIn);
Asn1ObjectIdentifier o = new Asn1ObjectIdentifier(oid);
Asn1ObjectIdentifier encO = (Asn1ObjectIdentifier)aIn.readObject();
if (!o.equals(encO))
{
fail("oid ID didn't match - got: " + o + " expected " + encO);
}
byte[] bytes = o.getEncoded();
if (bytes.length != enc.length)
{
fail("failed length test");
}
for (int i = 0; i != enc.length; i++)
{
if (bytes[i] != enc[i])
{
fail("failed comparison test - got: " + new String(Hex.encode(enc)) + " expected " + new String(Hex.encode(bytes)));
}
}
|
public void | testRecode()
recodeCheck("2.100.3", req1);
recodeCheck("1.2.54.34359733987.17", req2);
|
public void | testValue()
valueCheck(PKCSObjectIdentifiers.pkcs_9_at_contentType.getId());
valueCheck("1.1.127.32512.8323072.2130706432.545460846592.139637976727552.35747322042253312.9151314442816847872");
valueCheck("1.2.123.12345678901.1.1.1");
valueCheck("2.25.196556539987194312349856245628873852187.1");
|
private void | valueCheck(java.lang.String oid)
Asn1ObjectIdentifier o = new Asn1ObjectIdentifier(oid);
ByteArrayInputStream bIn = new ByteArrayInputStream(o.getEncoded());
Asn1InputStream aIn = new Asn1InputStream(bIn);
o = (Asn1ObjectIdentifier)aIn.readObject();
if (!o.toString().equals(oid))
{
fail("failed oid check for " + oid);
}
|