/** * Encode an ASN.1 set of certificates using the given DER encoder and the * given {@code X509Certificate} chain. * * @param encoder the DER encoder * @param certChain the X.509 certificate chain to encode * @throws ASN1Exception if an error occurs while encoding the given certificate chain */ public static void encodeX509CertificateChain(final DEREncoder encoder, X509Certificate[] certChain) throws ASN1Exception { try { int chainSize = certChain.length; encoder.startSetOf(); for (int i = 0; i < chainSize; i++) { encoder.writeEncoded(certChain[i].getEncoded()); } encoder.endSetOf(); } catch (CertificateEncodingException e) { throw new ASN1Exception(e); } }
/** * Encode {@code Attributes} using the given DER encoder. The ASN.1 definition of {@code Attributes} is: * * <pre> * Attributes ::= SET OF Attribute * * Attribute :: SEQUENCE { * type AttributeType, * values SET OF AttributeValue * } * * AttributeType ::= OBJECT IDENTIFIER * AttributeValue ::= ANY defined by type * </pre> * * @param encoder the DER encoder */ private void encodeAttributes(final DEREncoder encoder) { encoder.startSetOf(); encoder.startSequence(); // extensionRequest attribute encoder.encodeObjectIdentifier(ASN1.OID_EXTENSION_REQUEST); encoder.startSetOf(); encodeExtensionRequest(encoder); encoder.endSetOf(); encoder.endSequence(); encoder.endSetOf(); }
/** * Encode an ASN.1 set of certificates using the given DER encoder and the * given {@code X509Certificate} chain. * * @param encoder the DER encoder * @param certChain the X.509 certificate chain to encode * @throws ASN1Exception if an error occurs while encoding the given certificate chain */ public static void encodeX509CertificateChain(final DEREncoder encoder, X509Certificate[] certChain) throws ASN1Exception { try { int chainSize = certChain.length; encoder.startSetOf(); for (int i = 0; i < chainSize; i++) { encoder.writeEncoded(certChain[i].getEncoded()); } encoder.endSetOf(); } catch (CertificateEncodingException e) { throw new ASN1Exception(e); } }
/** * Encode an ASN.1 set of certificates using the given DER encoder and the * given {@code X509Certificate} chain. * * @param encoder the DER encoder * @param certChain the X.509 certificate chain to encode * @throws ASN1Exception if an error occurs while encoding the given certificate chain */ public static void encodeX509CertificateChain(final DEREncoder encoder, X509Certificate[] certChain) throws ASN1Exception { try { int chainSize = certChain.length; encoder.startSetOf(); for (int i = 0; i < chainSize; i++) { encoder.writeEncoded(certChain[i].getEncoded()); } encoder.endSetOf(); } catch (CertificateEncodingException e) { throw new ASN1Exception(e); } }
/** * Encode an ASN.1 set of certificates using the given DER encoder and the * given {@code X509Certificate} chain. * * @param encoder the DER encoder * @param certChain the X.509 certificate chain to encode * @throws ASN1Exception if an error occurs while encoding the given certificate chain */ public static void encodeX509CertificateChain(final DEREncoder encoder, X509Certificate[] certChain) throws ASN1Exception { try { int chainSize = certChain.length; encoder.startSetOf(); for (int i = 0; i < chainSize; i++) { encoder.writeEncoded(certChain[i].getEncoded()); } encoder.endSetOf(); } catch (CertificateEncodingException e) { throw new ASN1Exception(e); } }
/** * Encode {@code Attributes} using the given DER encoder. The ASN.1 definition of {@code Attributes} is: * * <pre> * Attributes ::= SET OF Attribute * * Attribute :: SEQUENCE { * type AttributeType, * values SET OF AttributeValue * } * * AttributeType ::= OBJECT IDENTIFIER * AttributeValue ::= ANY defined by type * </pre> * * @param encoder the DER encoder */ private void encodeAttributes(final DEREncoder encoder) { encoder.startSetOf(); encoder.startSequence(); // extensionRequest attribute encoder.encodeObjectIdentifier(ASN1.OID_EXTENSION_REQUEST); encoder.startSetOf(); encodeExtensionRequest(encoder); encoder.endSetOf(); encoder.endSequence(); encoder.endSetOf(); }
/** * Encode {@code Attributes} using the given DER encoder. The ASN.1 definition of {@code Attributes} is: * * <pre> * Attributes ::= SET OF Attribute * * Attribute :: SEQUENCE { * type AttributeType, * values SET OF AttributeValue * } * * AttributeType ::= OBJECT IDENTIFIER * AttributeValue ::= ANY defined by type * </pre> * * @param encoder the DER encoder */ private void encodeAttributes(final DEREncoder encoder) { encoder.startSetOf(); encoder.startSequence(); // extensionRequest attribute encoder.encodeObjectIdentifier(ASN1.OID_EXTENSION_REQUEST); encoder.startSetOf(); encodeExtensionRequest(encoder); encoder.endSetOf(); encoder.endSequence(); encoder.endSetOf(); }
/** * Encode {@code Attributes} using the given DER encoder. The ASN.1 definition of {@code Attributes} is: * * <pre> * Attributes ::= SET OF Attribute * * Attribute :: SEQUENCE { * type AttributeType, * values SET OF AttributeValue * } * * AttributeType ::= OBJECT IDENTIFIER * AttributeValue ::= ANY defined by type * </pre> * * @param encoder the DER encoder */ private void encodeAttributes(final DEREncoder encoder) { encoder.startSetOf(); encoder.startSequence(); // extensionRequest attribute encoder.encodeObjectIdentifier(ASN1.OID_EXTENSION_REQUEST); encoder.startSetOf(); encodeExtensionRequest(encoder); encoder.endSetOf(); encoder.endSequence(); encoder.endSetOf(); }