private KeyTransRecipientInfo computeRecipientInfo(X509Certificate x509certificate, byte[] abyte0) throws IOException, CertificateEncodingException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException { TBSCertificate certificate; try (ASN1InputStream input = new ASN1InputStream(x509certificate.getTBSCertificate())) { certificate = TBSCertificate.getInstance(input.readObject()); } AlgorithmIdentifier algorithmId = certificate.getSubjectPublicKeyInfo().getAlgorithm(); IssuerAndSerialNumber serial = new IssuerAndSerialNumber( certificate.getIssuer(), certificate.getSerialNumber().getValue()); Cipher cipher; try { cipher = Cipher.getInstance(algorithmId.getAlgorithm().getId(), SecurityProvider.getProvider()); } catch (NoSuchAlgorithmException | NoSuchPaddingException e) { // should never happen, if this happens throw IOException instead throw new RuntimeException("Could not find a suitable javax.crypto provider", e); } cipher.init(1, x509certificate.getPublicKey()); DEROctetString octets = new DEROctetString(cipher.doFinal(abyte0)); RecipientIdentifier recipientId = new RecipientIdentifier(serial); return new KeyTransRecipientInfo(recipientId, algorithmId, octets); }
public static TBSCertificate getInstance( ASN1TaggedObject obj, boolean explicit) { return getInstance(ASN1Sequence.getInstance(obj, explicit)); }
public static TBSCertificate getInstance( ASN1TaggedObject obj, boolean explicit) { return getInstance(ASN1Sequence.getInstance(obj, explicit)); }
static void checkCertificate(X509Certificate cert) throws AnnotatedException { try { TBSCertificate.getInstance(cert.getTBSCertificate()); } catch (CertificateEncodingException e) { throw new AnnotatedException("unable to process TBSCertificate", e); } catch (IllegalArgumentException e) { throw new AnnotatedException(e.getMessage()); } } }
private Certificate( ASN1Sequence seq) { this.seq = seq; // // correct x509 certficate // if (seq.size() == 3) { tbsCert = TBSCertificate.getInstance(seq.getObjectAt(0)); sigAlgId = AlgorithmIdentifier.getInstance(seq.getObjectAt(1)); sig = DERBitString.getInstance(seq.getObjectAt(2)); } else { throw new IllegalArgumentException("sequence wrong size for a certificate"); } }
private Certificate( ASN1Sequence seq) { this.seq = seq; // // correct x509 certficate // if (seq.size() == 3) { tbsCert = TBSCertificate.getInstance(seq.getObjectAt(0)); sigAlgId = AlgorithmIdentifier.getInstance(seq.getObjectAt(1)); sig = DERBitString.getInstance(seq.getObjectAt(2)); } else { throw new IllegalArgumentException("sequence wrong size for a certificate"); } }
TBSCertificate certificate = TBSCertificate.getInstance(input.readObject()); input.close();
private KeyTransRecipientInfo computeRecipientInfo(X509Certificate x509certificate, byte[] abyte0) throws IOException, CertificateEncodingException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException { TBSCertificate certificate; try (ASN1InputStream input = new ASN1InputStream(x509certificate.getTBSCertificate())) { certificate = TBSCertificate.getInstance(input.readObject()); } AlgorithmIdentifier algorithmId = certificate.getSubjectPublicKeyInfo().getAlgorithm(); IssuerAndSerialNumber serial = new IssuerAndSerialNumber( certificate.getIssuer(), certificate.getSerialNumber().getValue()); Cipher cipher; try { cipher = Cipher.getInstance(algorithmId.getAlgorithm().getId(), SecurityProvider.getProvider()); } catch (NoSuchAlgorithmException | NoSuchPaddingException e) { // should never happen, if this happens throw IOException instead throw new RuntimeException("Could not find a suitable javax.crypto provider", e); } cipher.init(1, x509certificate.getPublicKey()); DEROctetString octets = new DEROctetString(cipher.doFinal(abyte0)); RecipientIdentifier recipientId = new RecipientIdentifier(serial); return new KeyTransRecipientInfo(recipientId, algorithmId, octets); }
return TBSCertificate.getInstance(new DERSequence(seq));
return TBSCertificate.getInstance(new DERSequence(seq));
tbsCert = TBSCertificate.getInstance(caCert.getTBSCertificate()); } catch (CertificateEncodingException ex) { throw new OcspRequestorException(ex);
return TBSCertificate.getInstance(new DERSequence(v));
return TBSCertificate.getInstance(new DERSequence(v));