public static HashAlgo getNonNullInstance(String nameOrOid) { HashAlgo type = getInstance(nameOrOid); if (type == null) { throw new IllegalArgumentException("Unknown HashAlgo OID/name '" + nameOrOid + "'"); } return type; }
public static HashAlgo getNonNullInstance(ASN1ObjectIdentifier oid) { HashAlgo type = getInstance(oid); if (type == null) { throw new IllegalArgumentException("Unknown HashAlgo OID '" + oid.getId() + "'"); } return type; }
public static ASN1ObjectIdentifier getHashAlg(String hashAlgName) throws NoSuchAlgorithmException { Args.notBlank(hashAlgName, "hashAlgName"); HashAlgo hashAlgo = HashAlgo.getInstance(hashAlgName.toUpperCase()); if (hashAlgo == null) { throw new NoSuchAlgorithmException("Unsupported hash algorithm " + hashAlgName); } return hashAlgo.getOid(); } // method getHashAlg
public static int getHashOutputSizeInOctets(ASN1ObjectIdentifier hashAlgo) throws NoSuchAlgorithmException { Args.notNull(hashAlgo, "hashAlgo"); HashAlgo hashAlgoType = HashAlgo.getInstance(hashAlgo); if (hashAlgoType == null) { throw new NoSuchAlgorithmException("Unsupported hash algorithm " + hashAlgo.getId()); } return hashAlgoType.getLength(); } // method getHashOutputSizeInOctets
String certHashAlgoInDb = datasource.getFirstValue( null, "DBSCHEMA", "VALUE2", "NAME='CERTHASH_ALGO'", String.class); if (certhashAlgo != HashAlgo.getInstance(certHashAlgoInDb)) { throw new IllegalArgumentException( "certHashAlgo in parameter (" + certhashAlgo + ") != in DB (" + certHashAlgoInDb + ")");
String certHashAlgoInDb = datasource.getFirstValue( null, "DBSCHEMA", "VALUE2", "NAME='CERTHASH_ALGO'", String.class); if (certhashAlgo != HashAlgo.getInstance(certHashAlgoInDb)) { throw new IllegalArgumentException( "certHashAlgo in parameter (" + certhashAlgo + ") != in DB (" + certHashAlgoInDb + ")");
String certHashAlgoInDb = datasource.getFirstValue( null, "DBSCHEMA", "VALUE2", "NAME='CERTHASH_ALGO'", String.class); if (certHashAlgo != HashAlgo.getInstance(certHashAlgoInDb)) { throw new IllegalArgumentException("certHashAlgo in parameter (" + certHashAlgo + ") != in DB (" + certHashAlgoInDb + ")");
String certHashAlgoInDb = datasource.getFirstValue( null, "DBSCHEMA", "VALUE2", "NAME='CERTHASH_ALGO'", String.class); if (certHashAlgo != HashAlgo.getInstance(certHashAlgoInDb)) { throw new IllegalArgumentException("certHashAlgo in parameter (" + certHashAlgo + ") != in DB (" + certHashAlgoInDb + ")");
private static Digest getDigest(AlgorithmIdentifier hashAlgo) throws XiSecurityException { HashAlgo hat = HashAlgo.getInstance(hashAlgo.getAlgorithm()); if (hat != null) { return hat.createDigest(); } else { throw new XiSecurityException("could not get digest for " + hashAlgo.getAlgorithm().getId()); } }
public P11RSAPkcsPssParams(RSASSAPSSparams asn1Params) { ASN1ObjectIdentifier asn1Oid = asn1Params.getHashAlgorithm().getAlgorithm(); HashAlgo contentHashAlgo = HashAlgo.getInstance(asn1Oid); if (contentHashAlgo == null) { throw new IllegalArgumentException("unsupported hash algorithm " + asn1Oid.getId()); HashAlgo mgfHashAlgo = HashAlgo.getInstance(asn1Oid); if (mgfHashAlgo == null) { throw new IllegalArgumentException("unsupported MGF hash algorithm " + asn1Oid.getId());
public P11RSAPkcsPssParams(RSASSAPSSparams asn1Params) { ASN1ObjectIdentifier asn1Oid = asn1Params.getHashAlgorithm().getAlgorithm(); HashAlgo contentHashAlgo = HashAlgo.getInstance(asn1Oid); if (contentHashAlgo == null) { throw new IllegalArgumentException("unsupported hash algorithm " + asn1Oid.getId()); HashAlgo mgfHashAlgo = HashAlgo.getInstance(asn1Oid); if (mgfHashAlgo == null) { throw new IllegalArgumentException("unsupported MGF hash algorithm " + asn1Oid.getId());
HashAlgo hashAlgo = HashAlgo.getInstance(digestAlgOid); if (hashAlgo == null) { throw new XiSecurityException("unsupported hash algorithm " + digestAlgOid.getId());
@Override protected Object execute0() throws Exception { Certificate cert = X509Util.parseBcCert(IoUtil.read(inFile)); if (serial != null && serial) { return getNumber(cert.getSerialNumber().getPositiveValue()); } else if (subject != null && subject) { return cert.getSubject().toString(); } else if (issuer != null && issuer) { return cert.getIssuer().toString(); } else if (notBefore != null && notBefore) { return toUtcTimeyyyyMMddhhmmssZ(cert.getStartDate().getDate()); } else if (notAfter != null && notAfter) { return toUtcTimeyyyyMMddhhmmssZ(cert.getEndDate().getDate()); } else if (fingerprint != null && fingerprint) { byte[] encoded = cert.getEncoded(); return HashAlgo.getInstance(hashAlgo).hexHash(encoded); } return null; }
HashAlgo hashAlgo = HashAlgo.getInstance(digestAlgOid); if (hashAlgo == null) { throw new XiSecurityException("unsupported hash algorithm " + digestAlgOid.getId());
private OCSPRequest buildRequest(X509Certificate caCert, BigInteger[] serialNumbers, byte[] nonce, RequestOptions requestOptions) throws OcspRequestorException { HashAlgo hashAlgo = HashAlgo.getInstance(requestOptions.getHashAlgorithmId()); if (hashAlgo == null) { throw new OcspRequestorException("unknown HashAlgo "