use of de.rub.nds.asn1.model.Asn1ObjectIdentifier in project TLS-Scanner by tls-attacker.
the class OcspProbe method prepareNonceExtension.
private byte[] prepareNonceExtension() {
Asn1Sequence innerExtensionSequence = new Asn1Sequence();
Asn1ObjectIdentifier oid = new Asn1ObjectIdentifier();
oid.setValue(NONCE.getOID());
Asn1Sequence extensionSequence = new Asn1Sequence();
innerExtensionSequence.addChild(oid);
Asn1EncapsulatingOctetString encapsulatingOctetString = new Asn1EncapsulatingOctetString();
// Nonce
Asn1PrimitiveOctetString nonceOctetString = new Asn1PrimitiveOctetString();
Random rand = new Random(STAPLED_NONCE_RANDOM_SEED);
BigInteger nonce = new BigInteger(STAPLED_NONCE_RANDOM_BIT_LENGTH, rand);
nonceOctetString.setValue(nonce.toByteArray());
encapsulatingOctetString.addChild(nonceOctetString);
innerExtensionSequence.addChild(encapsulatingOctetString);
extensionSequence.addChild(innerExtensionSequence);
List<Asn1Encodable> asn1Encodables = new LinkedList<>();
asn1Encodables.add(extensionSequence);
Asn1Encoder asn1Encoder = new Asn1Encoder(asn1Encodables);
return asn1Encoder.encode();
}
use of de.rub.nds.asn1.model.Asn1ObjectIdentifier in project TLS-Scanner by RUB-NDS.
the class OcspProbe method prepareNonceExtension.
private byte[] prepareNonceExtension() {
Asn1Sequence innerExtensionSequence = new Asn1Sequence();
Asn1ObjectIdentifier oid = new Asn1ObjectIdentifier();
oid.setValue(NONCE.getOID());
Asn1Sequence extensionSequence = new Asn1Sequence();
innerExtensionSequence.addChild(oid);
Asn1EncapsulatingOctetString encapsulatingOctetString = new Asn1EncapsulatingOctetString();
// Nonce
Asn1PrimitiveOctetString nonceOctetString = new Asn1PrimitiveOctetString();
Random rand = new Random(STAPLED_NONCE_RANDOM_SEED);
BigInteger nonce = new BigInteger(STAPLED_NONCE_RANDOM_BIT_LENGTH, rand);
nonceOctetString.setValue(nonce.toByteArray());
encapsulatingOctetString.addChild(nonceOctetString);
innerExtensionSequence.addChild(encapsulatingOctetString);
extensionSequence.addChild(innerExtensionSequence);
List<Asn1Encodable> asn1Encodables = new LinkedList<>();
asn1Encodables.add(extensionSequence);
Asn1Encoder asn1Encoder = new Asn1Encoder(asn1Encodables);
return asn1Encoder.encode();
}
Aggregations