public static boolean isDsaOid( ASN1ObjectIdentifier algOid) { for (int i = 0; i != dsaOids.length; i++) { if (algOid.equals(dsaOids[i])) { return true; } } return false; }
public static boolean isDsaOid( ASN1ObjectIdentifier algOid) { for (int i = 0; i != dsaOids.length; i++) { if (algOid.equals(dsaOids[i])) { return true; } } return false; }
public static boolean isRsaOid( ASN1ObjectIdentifier algOid) { for (int i = 0; i != rsaOids.length; i++) { if (algOid.equals(rsaOids[i])) { return true; } } return false; }
protected ASN1Encodable encodeStringValue(ASN1ObjectIdentifier oid, String value) { if (oid.equals(dc)) { return new DERIA5String(value); } else if (oid.equals(c) || oid.equals(serialNumber) || oid.equals(dnQualifier) || oid.equals(telephoneNumber)) { return new DERPrintableString(value); } return super.encodeStringValue(oid, value); }
public PolicyInformation getPolicyInformation(ASN1ObjectIdentifier policyIdentifier) { for (int i = 0; i != policyInformation.length; i++) { if (policyIdentifier.equals(policyInformation[i].getPolicyIdentifier())) { return policyInformation[i]; } } return null; }
public PrivateKey generatePrivate(PrivateKeyInfo keyInfo) throws IOException { ASN1ObjectIdentifier algOid = keyInfo.getPrivateKeyAlgorithm().getAlgorithm(); if (algOid.equals(X9ObjectIdentifiers.id_ecPublicKey)) { return new BCECPrivateKey(algorithm, keyInfo, configuration); } else { throw new IOException("algorithm identifier " + algOid + " in key not recognised"); } }
public PublicKey generatePublic(SubjectPublicKeyInfo keyInfo) throws IOException { ASN1ObjectIdentifier algOid = keyInfo.getAlgorithm().getAlgorithm(); if (algOid.equals(X9ObjectIdentifiers.id_ecPublicKey)) { return new BCECPublicKey(algorithm, keyInfo, configuration); } else { throw new IOException("algorithm identifier " + algOid + " in key not recognised"); } }
public PrivateKey generatePrivate(PrivateKeyInfo keyInfo) throws IOException { ASN1ObjectIdentifier algOid = keyInfo.getPrivateKeyAlgorithm().getAlgorithm(); if (algOid.equals(CryptoProObjectIdentifiers.gostR3410_94)) { return new BCGOST3410PrivateKey(keyInfo); } else { throw new IOException("algorithm identifier " + algOid + " in key not recognised"); } }
public PrivateKey generatePrivate(PrivateKeyInfo keyInfo) throws IOException { ASN1ObjectIdentifier algOid = keyInfo.getPrivateKeyAlgorithm().getAlgorithm(); if (algOid.equals(CryptoProObjectIdentifiers.gostR3410_2001)) { return new BCECGOST3410PrivateKey(keyInfo); } else { throw new IOException("algorithm identifier " + algOid + " in key not recognised"); } }
/** * Determine whether the message is protected by a password based MAC. Use verify(PKMACBuilder, char[]) * to verify the message if this method returns true. * * @return true if protection MAC PBE based, false otherwise. */ public boolean hasPasswordBasedMacProtection() { return pkiMessage.getHeader().getProtectionAlg().getAlgorithm().equals(CMPObjectIdentifiers.passwordBasedMac); }
private static void validateInfoFormat(OtherRevocationInfoFormat infoFormat) { if (CMSObjectIdentifiers.id_ri_ocsp_response.equals(infoFormat.getInfoFormat())) { OCSPResponse resp = OCSPResponse.getInstance(infoFormat.getInfo()); if (resp.getResponseStatus().getValue().intValue() != OCSPResponseStatus.SUCCESSFUL) { throw new IllegalArgumentException("cannot add unsuccessful OCSP response to CMS SignedData"); } } }
private static void validateInfoFormat(OtherRevocationInfoFormat infoFormat) { if (CMSObjectIdentifiers.id_ri_ocsp_response.equals(infoFormat.getInfoFormat())) { OCSPResponse resp = OCSPResponse.getInstance(infoFormat.getInfo()); if (resp.getResponseStatus().getValue().intValue() != OCSPResponseStatus.SUCCESSFUL) { throw new IllegalArgumentException("cannot add unsuccessful OCSP response to CMS SignedData"); } } }
/** * Determine whether the message is protected by a password based MAC. Use verify(PKMACBuilder, char[]) * to verify the message if this method returns true. * * @return true if protection MAC PBE based, false otherwise. */ public boolean hasPasswordBasedMacProtection() { return pkiMessage.getHeader().getProtectionAlg().getAlgorithm().equals(CMPObjectIdentifiers.passwordBasedMac); }
public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof BCXMSSPublicKey) { BCXMSSPublicKey otherKey = (BCXMSSPublicKey)o; return treeDigest.equals(otherKey.treeDigest) && Arrays.areEqual(keyParams.toByteArray(), otherKey.keyParams.toByteArray()); } return false; }
public PKCS12SafeBagFactory(ContentInfo info) { if (info.getContentType().equals(PKCSObjectIdentifiers.encryptedData)) { throw new IllegalArgumentException("encryptedData requires constructor with decryptor."); } this.safeBagSeq = ASN1Sequence.getInstance(ASN1OctetString.getInstance(info.getContent()).getOctets()); }
private void initialize(ContentInfo contentInfo) { this.contentInfo = contentInfo; if (CMSObjectIdentifiers.timestampedData.equals(contentInfo.getContentType())) { this.timeStampedData = TimeStampedData.getInstance(contentInfo.getContent()); } else { throw new IllegalArgumentException("Malformed content - type must be " + CMSObjectIdentifiers.timestampedData.getId()); } util = new TimeStampDataUtil(this.timeStampedData); }
private void initialize(ContentInfo contentInfo) { this.contentInfo = contentInfo; if (CMSObjectIdentifiers.timestampedData.equals(contentInfo.getContentType())) { this.timeStampedData = TimeStampedData.getInstance(contentInfo.getContent()); } else { throw new IllegalArgumentException("Malformed content - type must be " + CMSObjectIdentifiers.timestampedData.getId()); } util = new TimeStampDataUtil(this.timeStampedData); }
public AlgorithmIdentifier find(AlgorithmIdentifier sigAlgId) { AlgorithmIdentifier digAlgId; if (sigAlgId.getAlgorithm().equals(PKCSObjectIdentifiers.id_RSASSA_PSS)) { digAlgId = RSASSAPSSparams.getInstance(sigAlgId.getParameters()).getHashAlgorithm(); } else { digAlgId = new AlgorithmIdentifier((ASN1ObjectIdentifier)digestOids.get(sigAlgId.getAlgorithm()), DERNull.INSTANCE); } return digAlgId; }
public boolean equals( Object o) { if (!(o instanceof Extension)) { return false; } Extension other = (Extension)o; return other.getExtnId().equals(this.getExtnId()) && other.getExtnValue().equals(this.getExtnValue()) && (other.isCritical() == this.isCritical()); }