org.bouncycastle.asn1.DERInteger Java Examples
The following examples show how to use
org.bouncycastle.asn1.DERInteger.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CRLCertificateVerifier.java From oxAuth with MIT License | 5 votes |
@SuppressWarnings({ "deprecation", "resource" }) private BigInteger getCrlNumber(X509CRL crl) throws IOException { byte[] crlNumberExtensionValue = crl.getExtensionValue(X509Extensions.CRLNumber.getId()); if (crlNumberExtensionValue == null) { return null; } DEROctetString octetString = (DEROctetString) (new ASN1InputStream(new ByteArrayInputStream(crlNumberExtensionValue)).readObject()); byte[] octets = octetString.getOctets(); DERInteger integer = (DERInteger) new ASN1InputStream(octets).readObject(); BigInteger crlNumber = integer.getPositiveValue(); return crlNumber; }
Example #2
Source File: KrbKeySetEncoder.java From cloudbreak with Apache License 2.0 | 5 votes |
public static String getASNEncodedKrbPrincipalKey(List<ActorKerberosKey> keys) throws IOException { ASN1Encodable[] asn1Encodables = new ASN1Encodable[keys.size()]; for (int i = 0; i < keys.size(); i++) { ActorKerberosKey key = keys.get(i); byte[] byteValue = Base64.getDecoder().decode(key.getKeyValue().getBytes(StandardCharsets.UTF_8)); asn1Encodables[i] = makeKrbKey(makeSalt(key.getSaltType(), key.getSaltValue()), makeEncryptionKey(key.getKeyType(), byteValue)); } DERSequence krbKeys = new DERSequence(asn1Encodables); DERSequence krbKeySet = new DERSequence(new ASN1Encodable[]{ // attribute-major-vno new DERTaggedObject(true, TAG_ATTRIBUTE_MAJOR_VNO, new DERInteger(1)), // attribute-minor-vno new DERTaggedObject(true, TAG_ATTRIBUTE_MINOR_VNO, new DERInteger(1)), // kvno new DERTaggedObject(true, TAG_KVNO, new DERInteger(1)), // mkvno new DERTaggedObject(true, TAG_MKVNO, new DERInteger(1)), new DERTaggedObject(true, TAG_KEYS, krbKeys) }); return Base64.getEncoder().encodeToString(krbKeySet.getEncoded()); }
Example #3
Source File: KrbKeySetEncoder.java From cloudbreak with Apache License 2.0 | 4 votes |
private static DERSequence makeSalt(int type, String salt) throws UnsupportedEncodingException { return new DERSequence(new ASN1Encodable[]{ new DERTaggedObject(true, TAG_ATTRIBUTE_MAJOR_VNO, new DERInteger(type)), new DERTaggedObject(true, TAG_ATTRIBUTE_MINOR_VNO, new DEROctetString(salt.getBytes(StandardCharsets.UTF_8))) }); }
Example #4
Source File: KrbKeySetEncoder.java From cloudbreak with Apache License 2.0 | 4 votes |
private static DERSequence makeEncryptionKey(int enctype, byte[] value) { return new DERSequence(new ASN1Encodable[]{ new DERTaggedObject(true, TAG_ATTRIBUTE_MAJOR_VNO, new DERInteger(enctype)), new DERTaggedObject(true, TAG_ATTRIBUTE_MINOR_VNO, new DEROctetString(value)) }); }