String requestPolicy = signatureConfig.getTspRequestPolicy(); if (requestPolicy != null) { requestGenerator.setReqPolicy(new ASN1ObjectIdentifier(requestPolicy));
CMSProcessableInputStream(InputStream is) { this(new ASN1ObjectIdentifier(CMSObjectIdentifiers.data.getId()), is); }
private ASN1ObjectIdentifier getHashObjectIdentifier(String algorithm) { switch (algorithm) { case "MD2": return new ASN1ObjectIdentifier(PKCSObjectIdentifiers.md2.getId()); case "MD5": return new ASN1ObjectIdentifier(PKCSObjectIdentifiers.md5.getId()); case "SHA-1": return new ASN1ObjectIdentifier(OIWObjectIdentifiers.idSHA1.getId()); case "SHA-224": return new ASN1ObjectIdentifier(NISTObjectIdentifiers.id_sha224.getId()); case "SHA-256": return new ASN1ObjectIdentifier(NISTObjectIdentifiers.id_sha256.getId()); case "SHA-384": return new ASN1ObjectIdentifier(NISTObjectIdentifiers.id_sha384.getId()); case "SHA-512": return new ASN1ObjectIdentifier(NISTObjectIdentifiers.id_sha512.getId()); default: return new ASN1ObjectIdentifier(algorithm); } } }
DERSet set = new DERSet(new RecipientInfo(recipientInfo)); AlgorithmIdentifier algorithmId = new AlgorithmIdentifier(new ASN1ObjectIdentifier(algorithm), object); EncryptedContentInfo encryptedInfo = new EncryptedContentInfo(PKCSObjectIdentifiers.data, algorithmId, new DEROctetString(bytes));
new ASN1ObjectIdentifier(BASIC_CONSTRAINTS_EXTENSION), false, new DERSequence(ASN1Boolean.TRUE))
/** * Set the request policy * * @param policyOid * the policy oid to use */ public void setPolicyOid(final String policyOid) { this.policyOid = new ASN1ObjectIdentifier(policyOid); }
public AttributeTypeAndValue( String oid, ASN1Encodable value) { this(new ASN1ObjectIdentifier(oid), value); }
/** * @deprecated use ASN1ObjectIdentifier * @param objectId */ public AlgorithmIdentifier( String objectId) { this.objectId = new ASN1ObjectIdentifier(objectId); }
public AttributeTypeAndValue( String oid, ASN1Encodable value) { this(new ASN1ObjectIdentifier(oid), value); }
private static ExtendedKeyUsage listToExtendedKeyUsage(List<String> oidList) { List<KeyPurposeId> usages = new ArrayList<KeyPurposeId>(); for (String oid : oidList) { usages.add(KeyPurposeId.getInstance(new ASN1ObjectIdentifier(oid))); } return new ExtendedKeyUsage(usages.toArray(new KeyPurposeId[usages.size()])); }
public static Set<ASN1ObjectIdentifier> toOidSet(final List<OidWithDescType> oidWithDescTypes) { if (CollectionUtil.isEmpty(oidWithDescTypes)) { return null; } Set<ASN1ObjectIdentifier> oids = new HashSet<>(); for (OidWithDescType type : oidWithDescTypes) { oids.add(new ASN1ObjectIdentifier(type.getValue())); } return Collections.unmodifiableSet(oids); }
private HashAlgo(int length, AlgorithmCode algorithmCode, String oid, String name) { this.length = length; this.algorithmCode = algorithmCode; this.oid = new ASN1ObjectIdentifier(oid).intern(); this.algId = new AlgorithmIdentifier(this.oid, DERNull.INSTANCE); this.name = name; try { this.encoded = new ASN1ObjectIdentifier(oid).getEncoded(); } catch (IOException ex) { throw new IllegalArgumentException("invalid oid: " + oid); } }
/** * add a given extension field for the standard extensions tag (tag 0) */ public void addExtension( ASN1ObjectIdentifier oid, boolean critical, byte[] value) { extGenerator.addExtension(new ASN1ObjectIdentifier(oid.getId()), critical, value); }
/** * add a given extension field for the standard extensions tag (tag 3) */ public void addExtension( ASN1ObjectIdentifier oid, boolean critical, ASN1Encodable value) { extGenerator.addExtension(new ASN1ObjectIdentifier(oid.getId()), critical, value); }
public static ASN1ObjectIdentifier getCurveOidForCurveNameOrOid(final String curveNameOrOid) { ParamUtil.requireNonBlank("curveNameOrOid", curveNameOrOid); ASN1ObjectIdentifier oid; try { oid = new ASN1ObjectIdentifier(curveNameOrOid); } catch (Exception ex) { oid = getCurveOidForName(curveNameOrOid); } return oid; }
ASN1EncodableVector signedAttributes = new ASN1EncodableVector(); signedAttributes.add(new Attribute(CMSAttributes.contentType, new DERSet(new ASN1ObjectIdentifier("1.2.840.113549.1.7.1")))); signedAttributes.add(new Attribute(CMSAttributes.messageDigest, new DERSet(new DEROctetString(digestBytes)))); signedAttributes.add(new Attribute(CMSAttributes.signingTime, new DERSet(new DERUTCTime(signingDate)))); AttributeTable signedAttributesTable = new AttributeTable(signedAttributes);
private void addExtKeyUsage(X509ExtensionSet extensionSet, String ekuOid) throws IOException { ExtendedKeyUsage eku = new ExtendedKeyUsage( new KeyPurposeId[] { KeyPurposeId.getInstance(new ASN1ObjectIdentifier(ekuOid)) }); byte[] ekuEncoded = wrapInOctetString(eku.getEncoded()); extensionSet.addExtension(X509ExtensionType.EXTENDED_KEY_USAGE.oid(), false, ekuEncoded); }
ASN1EncodableVector v = new ASN1EncodableVector(); v.add(csrInfo); ASN1ObjectIdentifier oid = new ASN1ObjectIdentifier("0.0"); v.add(new DERSequence(oid)); v.add(new DERBitString(new byte[] {})); byte[] encoded = new DERSequence(v).getEncoded(); byte[] PKCS10= DataSignGeneration(encoded);
private static NamingAuthority buildNamingAuthority(final NamingAuthorityType jaxb) { ASN1ObjectIdentifier oid = (jaxb.getOid() == null) ? null : new ASN1ObjectIdentifier(jaxb.getOid().getValue()); String url = StringUtil.isBlank(jaxb.getUrl()) ? null : jaxb.getUrl(); DirectoryString text = StringUtil.isBlank(jaxb.getText()) ? null : new DirectoryString(jaxb.getText()); return new NamingAuthority(oid, url, text); }
private ASN1Sequence createSignedPublicKeyAndChallenge() throws SpkacException { ASN1EncodableVector vec = new ASN1EncodableVector (); vec.add(new ASN1ObjectIdentifier(getSignatureAlgorithm().oid())); vec.add(DERNull.INSTANCE); DERSequence signatureAlgorithm = new DERSequence(vec); vec = new ASN1EncodableVector (); vec.add(createPublicKeyAndChallenge()); vec.add(signatureAlgorithm); vec.add(new DERBitString(signature)); return new DERSequence(vec); }