continue; if (attribute.getAttrType().equals(PKCSObjectIdentifiers.pkcs_9_at_extensionRequest)) { final Extensions extensions = Extensions.getInstance(attribute.getAttrValues().getObjectAt(0)); final GeneralNames gns = GeneralNames.fromExtensions(extensions, Extension.subjectAlternativeName);
private static void validateAttributes(ASN1Set attributes) { if (attributes == null) { return; } for (Enumeration en = attributes.getObjects(); en.hasMoreElements();) { Attribute attr = Attribute.getInstance(en.nextElement()); if (attr.getAttrType().equals(PKCSObjectIdentifiers.pkcs_9_at_challengePassword)) { if (attr.getAttrValues().size() != 1) { throw new IllegalArgumentException("challengePassword attribute must have one value"); } } } } }
private static void populateTextField(Attribute[] attrs, JTextField textField, ASN1ObjectIdentifier pkcs9Attr) { if (attrs != null) { for (Attribute attribute : attrs) { ASN1ObjectIdentifier attributeOid = attribute.getAttrType(); if (attributeOid.equals(pkcs9Attr)) { ASN1Encodable challenge = attribute.getAttributeValues()[0]; // data type can be one of IA5String or UTF8String if (challenge instanceof DERPrintableString) { textField.setText(((DERPrintableString) challenge).getString()); } else if (challenge instanceof DERUTF8String) { textField.setText(((DERUTF8String) challenge).getString()); } textField.setCaretPosition(0); } } } } }
private ASN1Encodable getChallengePassword(Attribute[] attributes) { for (Attribute attribute : attributes) { if (PKCSObjectIdentifiers.pkcs_9_at_challengePassword.equals(attribute.getAttrType())) { if (attribute.getAttrValues() != null && attribute.getAttrValues().size() > 0) { return attribute.getAttrValues().getObjectAt(0); } } } return null; }
private static String getChallengePassword(CertificationRequestInfo csr) { ASN1Set attrs = csr.getAttributes(); for (int i = 0; i < attrs.size(); i++) { Attribute attr = Attribute.getInstance(attrs.getObjectAt(i)); if (PKCSObjectIdentifiers.pkcs_9_at_challengePassword.equals(attr.getAttrType())) { ASN1String str = (ASN1String) attr.getAttributeValues()[0]; return str.getString(); } } return null; }
/** * Extracts the <tt>Challenge password</tt> from the provided CSR. * <p> * * @param csr * the CSR to extract from. * @return the extracted <tt>Challenge password</tt> */ public static String getChallengePassword(final PKCS10CertificationRequest csr) { Attribute[] attrs = csr.getAttributes(); for (Attribute attr : attrs) { if (attr.getAttrType().equals( PKCSObjectIdentifiers.pkcs_9_at_challengePassword)) { // According to RFC 2985 this may be any of the DirectoryString // types, but we can be more flexible and allow any ASN.1 // string. ASN1String challengePassword = (ASN1String) attr .getAttrValues().getObjectAt(0); return challengePassword.getString(); } } return null; }
public static Extensions getExtensions(CertificationRequestInfo csr) { Args.notNull(csr, "csr"); ASN1Set attrs = csr.getAttributes(); for (int i = 0; i < attrs.size(); i++) { Attribute attr = Attribute.getInstance(attrs.getObjectAt(i)); if (PKCSObjectIdentifiers.pkcs_9_at_extensionRequest.equals(attr.getAttrType())) { return Extensions.getInstance(attr.getAttributeValues()[0]); } } return null; }
public static String getChallengePassword(CertificationRequestInfo csr) { Args.notNull(csr, "csr"); ASN1Set attrs = csr.getAttributes(); for (int i = 0; i < attrs.size(); i++) { Attribute attr = Attribute.getInstance(attrs.getObjectAt(i)); if (PKCSObjectIdentifiers.pkcs_9_at_challengePassword.equals(attr.getAttrType())) { ASN1String str = (ASN1String) attr.getAttributeValues()[0]; return str.getString(); } } return null; }
private void parseRequestedExtensions() throws IOException { Attribute[] attrs = csr.getAttributes(); if (attrs == null) return; for (Attribute attr: attrs) { if (PKCSObjectIdentifiers.pkcs_9_at_extensionRequest.getId().equals( attr.getAttrType().getId())) { if (attr.getAttrValues().size() == 0) continue; ASN1Encodable req = attr.getAttrValues().getObjectAt(0); CertificateExtension ext = new CertificateExtension(req.toASN1Primitive().getEncoded(ASN1Encoding.DER)); handleRequestedExtension(ext); } } }
proxySubjectName, subjectPublicKeyInfo); for (Attribute attribute: attributes) builder.addAttribute(attribute.getAttrType(), attribute.getAttributeValues()); AlgorithmIdentifier signatureAi = new AlgorithmIdentifier(OIWObjectIdentifiers.sha1WithRSA); AlgorithmIdentifier hashAi = new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1);
for (int i = 0; i < attrs.size(); i++) { Attribute attr = Attribute.getInstance(attrs.getObjectAt(i)); if (PKCSObjectIdentifiers.pkcs_9_at_extensionRequest.equals(attr.getAttrType())) { extensions = Extensions.getInstance(attr.getAttributeValues()[0]);
for (int i = 0; i < attrs.size(); i++) { Attribute attr = Attribute.getInstance(attrs.getObjectAt(i)); if (PKCSObjectIdentifiers.pkcs_9_at_extensionRequest.equals(attr.getAttrType())) { extensions = Extensions.getInstance(attr.getAttributeValues()[0]);