/** * Attempt to acquire parameters from the given key. * * @param key the key (must not be {@code null}) * @return the parameters, or {@code null} if no known parameters are available */ public static AlgorithmParameterSpec getParameters(Key key) { return getParameters(key, AlgorithmParameterSpec.class); }
ParamKey(final AlgorithmParameterSpec parameterSpec) { this.parameterSpec = parameterSpec; this.hashCode = KeyUtil.parametersHashCode(parameterSpec); }
boolean isEqual(final Key key) { return key instanceof ECPrivateKey && isEqual((ECPrivateKey) key); }
Object writeReplace() { return new KeyRep(KeyRep.Type.PRIVATE, getAlgorithm(), getFormat(), getEncoded()); } }
/** * Determine if the given key has parameters which match the given parameters. * * @param key the key (must not be {@code null}) * @param parameters the parameters (must not be {@code null}) * @return {@code true} if the parameters match, {@code false} otherwise */ public static boolean hasParameters(final Key key, final AlgorithmParameterSpec parameters) { Assert.checkNotNullParam("key", key); Assert.checkNotNullParam("parameters", parameters); final AlgorithmParameterSpec keyParameters = getParameters(key, AlgorithmParameterSpec.class); return keyParameters != null && parametersEqual(keyParameters, parameters); }
public SecretKeyCredential clone() { final SecretKey secretKey = this.secretKey; final SecretKey clone = KeyUtil.cloneKey(SecretKey.class, secretKey); return clone == secretKey ? this : new SecretKeyCredential(clone); }
boolean isEqual(final Key key) { return key instanceof RSAPrivateCrtKey && isEqual((RSAPrivateCrtKey) key); }
public final boolean equals(final Object obj) { return this == obj || obj instanceof Key && isEqual((Key) obj); }
boolean isEqual(final Key key) { return key instanceof DSAPrivateKey && isEqual((DSAPrivateKey) key); }
boolean isEqual(final Key key) { return key instanceof RSAPrivateKey && isEqual((RSAPrivateKey) key); }
boolean isEqual(final Key key) { return key instanceof RSAMultiPrimePrivateCrtKey && isEqual((RSAMultiPrimePrivateCrtKey) key); }
boolean isEqual(final Key key) { return key instanceof DHPrivateKey && isEqual((DHPrivateKey) key); }
boolean isEqual(final Key key) { return key instanceof PBEKey && isEqual((PBEKey) key); }
protected RSAParameterSpec engineDecode(final ASN1Decoder decoder) { return new RSAParameterSpec(decoder.decodeInteger()); } }
public <P extends AlgorithmParameterSpec> P getParameters(final Class<P> paramSpecClass) { return KeyUtil.getParameters(secretKey, paramSpecClass); }
public X509CertificateChainPrivateCredential clone() { final PrivateKey privateKey = this.privateKey; final PrivateKey clone = KeyUtil.cloneKey(PrivateKey.class, privateKey); return privateKey == clone ? this : new X509CertificateChainPrivateCredential(clone, getCertificateChain()); }
public boolean supportsParameters(final Class<? extends AlgorithmParameterSpec> paramSpecClass) { return KeyUtil.getParameters(publicKey, paramSpecClass) != null; }
public boolean supportsParameters(final Class<? extends AlgorithmParameterSpec> paramSpecClass) { return KeyUtil.getParameters(secretKey, paramSpecClass) != null; }
public <P extends AlgorithmParameterSpec> P getParameters(final Class<P> paramSpecClass) { return KeyUtil.getParameters(publicKey, paramSpecClass); }
public <P extends AlgorithmParameterSpec> P getParameters(final Class<P> paramSpecClass) { return KeyUtil.getParameters(keyPair.getPublic(), paramSpecClass); }