@Override public PublicKey generatePublic(SubjectPublicKeyInfo publicKeyInfo) throws IOException { return getKeyInfoConverter().generatePublic(publicKeyInfo); } }
@Override public PrivateKey generatePrivate(PrivateKeyInfo privateKeyInfo) throws IOException { return getKeyInfoConverter().generatePrivate(privateKeyInfo); }
/** * Finds checksum by name. * * @param digest digest name * @return digest instance */ private static Digest getDigest(final String digest) { try { return new JceDigest(digest); } catch (CryptoException e) { String noHyphen = digest.replaceFirst("-", ""); return DigestFactory.getDigest(noHyphen); } }
private byte[] getOutput() throws BadPaddingException { try { return cipher.processBlock(bOut.getBuf(), 0, bOut.size()); } catch (InvalidCipherTextException e) { throw new BadBlockException("unable to decrypt block", e); } catch (ArrayIndexOutOfBoundsException e) { throw new BadBlockException("unable to decrypt block", e); } finally { bOut.erase(); } }
private void loadAlgorithms(String packageName, String[] names) { for (int i = 0; i != names.length; i++) { Class clazz = ClassUtil.loadClass(BouncyCastleProvider.class, packageName + names[i] + "$Mappings"); if (clazz != null) { try { ((AlgorithmProvider)clazz.newInstance()).configure(this); } catch (Exception e) { // this should never ever happen!! throw new InternalError("cannot create instance of " + packageName + names[i] + "$Mappings : " + e); } } } }
protected P11RSAPSSSignatureSpi(final PSSParameterSpec baseParamSpec, final boolean isRaw) { this.originalSpec = baseParamSpec; this.paramSpec = (baseParamSpec == null) ? PSSParameterSpec.DEFAULT : baseParamSpec; this.mgfDigest = DigestFactory.getDigest(paramSpec.getDigestAlgorithm()); this.saltLength = paramSpec.getSaltLength(); this.trailer = getTrailer(paramSpec.getTrailerField()); this.isRaw = isRaw; setupContentDigest(); }
@Override public PublicKey generatePublic(SubjectPublicKeyInfo publicKeyInfo) throws IOException { return getKeyInfoConverter().generatePublic(publicKeyInfo); } }
@Override public PrivateKey generatePrivate(PrivateKeyInfo privateKeyInfo) throws IOException { return getKeyInfoConverter().generatePrivate(privateKeyInfo); }
private byte[] getOutput() throws BadPaddingException { try { return cipher.processBlock(bOut.getBuf(), 0, bOut.size()); } catch (InvalidCipherTextException e) { throw new BadBlockException("unable to decrypt block", e); } catch (ArrayIndexOutOfBoundsException e) { throw new BadBlockException("unable to decrypt block", e); } finally { bOut.erase(); } }
protected P11RSAPSSSignatureSpi(PSSParameterSpec baseParamSpec, boolean isRaw) { this.originalSpec = baseParamSpec; this.paramSpec = (baseParamSpec == null) ? PSSParameterSpec.DEFAULT : baseParamSpec; this.mgfDigest = DigestFactory.getDigest(paramSpec.getDigestAlgorithm()); this.saltLength = paramSpec.getSaltLength(); this.trailer = getTrailer(paramSpec.getTrailerField()); this.isRaw = isRaw; setupContentDigest(); }
public static PublicKey getPublicKey(SubjectPublicKeyInfo publicKeyInfo) throws IOException { AsymmetricKeyInfoConverter converter = getAsymmetricKeyInfoConverter(publicKeyInfo.getAlgorithm().getAlgorithm()); if (converter == null) { return null; } return converter.generatePublic(publicKeyInfo); }
public static PrivateKey getPrivateKey(PrivateKeyInfo privateKeyInfo) throws IOException { AsymmetricKeyInfoConverter converter = getAsymmetricKeyInfoConverter(privateKeyInfo.getPrivateKeyAlgorithm().getAlgorithm()); if (converter == null) { return null; } return converter.generatePrivate(privateKeyInfo); }
protected P11RSAPSSSignatureSpi(PSSParameterSpec baseParamSpec, boolean isRaw) { this.originalSpec = baseParamSpec; this.paramSpec = (baseParamSpec == null) ? PSSParameterSpec.DEFAULT : baseParamSpec; this.mgfDigest = DigestFactory.getDigest(paramSpec.getDigestAlgorithm()); this.saltLength = paramSpec.getSaltLength(); this.trailer = getTrailer(paramSpec.getTrailerField()); this.isRaw = isRaw; setupContentDigest(); }
public static PublicKey getPublicKey(SubjectPublicKeyInfo publicKeyInfo) throws IOException { AsymmetricKeyInfoConverter converter = getAsymmetricKeyInfoConverter(publicKeyInfo.getAlgorithm().getAlgorithm()); if (converter == null) { return null; } return converter.generatePublic(publicKeyInfo); }
public static PrivateKey getPrivateKey(PrivateKeyInfo privateKeyInfo) throws IOException { AsymmetricKeyInfoConverter converter = getAsymmetricKeyInfoConverter(privateKeyInfo.getPrivateKeyAlgorithm().getAlgorithm()); if (converter == null) { return null; } return converter.generatePrivate(privateKeyInfo); } }
protected PSSSignatureSpi( AsymmetricBlockCipher signer, PSSParameterSpec baseParamSpec, boolean isRaw) { this.signer = signer; this.originalSpec = baseParamSpec; if (baseParamSpec == null) { this.paramSpec = PSSParameterSpec.DEFAULT; } else { this.paramSpec = baseParamSpec; } this.mgfDigest = DigestFactory.getDigest(paramSpec.getDigestAlgorithm()); this.saltLength = paramSpec.getSaltLength(); this.trailer = getTrailer(paramSpec.getTrailerField()); this.isRaw = isRaw; setupContentDigest(); }
@Override public PublicKey generatePublic(SubjectPublicKeyInfo publicKeyInfo) throws IOException { AsymmetricKeyFactory factory = getKeyFactory(publicKeyInfo); if (factory instanceof AsymmetricKeyInfoConverter) { return ((AsymmetricKeyInfoConverter) factory).generatePublic(publicKeyInfo); } return factory.toKey(fromX509(publicKeyInfo.getEncoded())); } }
@Override public PrivateKey generatePrivate(PrivateKeyInfo privateKeyInfo) throws IOException { AsymmetricKeyFactory factory = getKeyFactory(privateKeyInfo); if (factory instanceof AsymmetricKeyInfoConverter) { return ((AsymmetricKeyInfoConverter) factory).generatePrivate(privateKeyInfo); } return factory.toKey(fromPKCS8(privateKeyInfo.getEncoded())); }
@Override public PublicKey generatePublic(SubjectPublicKeyInfo publicKeyInfo) throws IOException { AsymmetricKeyFactory factory = getKeyFactory(publicKeyInfo); if (factory instanceof AsymmetricKeyInfoConverter) { return ((AsymmetricKeyInfoConverter) factory).generatePublic(publicKeyInfo); } return factory.toKey(fromX509(publicKeyInfo.getEncoded())); } }
@Override public PrivateKey generatePrivate(PrivateKeyInfo privateKeyInfo) throws IOException { AsymmetricKeyFactory factory = getKeyFactory(privateKeyInfo); if (factory instanceof AsymmetricKeyInfoConverter) { return ((AsymmetricKeyInfoConverter) factory).generatePrivate(privateKeyInfo); } return factory.toKey(fromPKCS8(privateKeyInfo.getEncoded())); }