Examples of SubjectKeyIdentifier


Examples of org.bouncycastle.asn1.x509.SubjectKeyIdentifier

     * @deprecated use version taking a SubjectKeyIdentifier
     */
    public OriginatorIdentifierOrKey(
        ASN1OctetString id)
    {
        this(new SubjectKeyIdentifier(id.getOctets()));
    }
View Full Code Here

Examples of org.bouncycastle.asn1.x509.SubjectKeyIdentifier

        ByteArrayInputStream _bais = new ByteArrayInputStream(_pubKey
                .getEncoded());
        SubjectPublicKeyInfo _info = new SubjectPublicKeyInfo(
                (ASN1Sequence)new ASN1InputStream(_bais).readObject());
        return new SubjectKeyIdentifier(_info);
    }
View Full Code Here

Examples of org.bouncycastle.asn1.x509.SubjectKeyIdentifier

        oids.add(X509Extensions.BasicConstraints);
        values.add(new X509Extension(true, new DEROctetString(new BasicConstraints(true))));
        oids.add(X509Extensions.KeyUsage);
        values.add(new X509Extension(true, new DEROctetString(
            new KeyUsage(KeyUsage.keyCertSign | KeyUsage.cRLSign))));
        SubjectKeyIdentifier subjectKeyIdentifier = new SubjectKeyIdentifierStructure(pair.getPublic());
        X509Extension ski = new X509Extension(false, new DEROctetString(subjectKeyIdentifier));
        oids.add(X509Extensions.SubjectKeyIdentifier);
        values.add(ski);

        Attribute attribute = new Attribute(PKCSObjectIdentifiers.pkcs_9_at_extensionRequest,
View Full Code Here

Examples of org.bouncycastle.asn1.x509.SubjectKeyIdentifier

        try
        {
            SubjectPublicKeyInfo info = new SubjectPublicKeyInfo(
                (ASN1Sequence)ASN1Primitive.fromByteArray(pubKey.getEncoded()));

            return new SubjectKeyIdentifier(info);
        }
        catch (Exception e)
        {
            throw new RuntimeException("error creating key");
        }
View Full Code Here

Examples of org.bouncycastle.asn1.x509.SubjectKeyIdentifier

    {
        try
        {
            SubjectPublicKeyInfo info = SubjectPublicKeyInfo.getInstance(pubKey.getEncoded());

            return (ASN1OctetString)(new SubjectKeyIdentifier(info).toASN1Object());
        }
        catch (Exception e)
        {
            throw new InvalidKeyException("Exception extracting key details: " + e.toString());
        }
View Full Code Here

Examples of org.bouncycastle.asn1.x509.SubjectKeyIdentifier

          builder.build(),
          generateSerialNumber(BigInteger.valueOf(KEY_SIZE)),
          calBegin.getTime(), calEnd.getTime(), builder.build(),
          kp.getPublic());
      certGen.addExtension(X509Extension.subjectKeyIdentifier, false,
          new SubjectKeyIdentifier(kp.getPublic().getEncoded()));
      certGen.addExtension(X509Extension.basicConstraints, false,
          new BasicConstraints(0));
      // convert the certificate to a standard one
      final X509Certificate cert = new JcaX509CertificateConverter()
          .setProvider(BouncyCastleProvider.PROVIDER_NAME)
View Full Code Here

Examples of org.bouncycastle.asn1.x509.SubjectKeyIdentifier

        ByteArrayInputStream _bais = new ByteArrayInputStream(_pubKey
                .getEncoded());
        SubjectPublicKeyInfo _info = new SubjectPublicKeyInfo(
                (ASN1Sequence)new ASN1InputStream(_bais).readObject());
        return new SubjectKeyIdentifier(_info);
    }
View Full Code Here

Examples of org.bouncycastle.asn1.x509.SubjectKeyIdentifier

        try
        {
            SubjectPublicKeyInfo info = new SubjectPublicKeyInfo(
                (ASN1Sequence) ASN1Object.fromByteArray(pubKey.getEncoded()));

            return new SubjectKeyIdentifier(info);
        }
        catch (Exception e)
        {
            throw new RuntimeException("error creating key");
        }
View Full Code Here

Examples of org.bouncycastle.asn1.x509.SubjectKeyIdentifier

        byte[] derValue = certificate.getExtensionValue(X509Extensions.SubjectKeyIdentifier.getId());
        if (derValue == null || derValue.length == 0) {
            return null;
        }

        SubjectKeyIdentifier ski = null;
        try {
            ski = new SubjectKeyIdentifierStructure(derValue);
        } catch (IOException e) {
            log.error("Unable to extract subject key identifier from certificate: ASN.1 parsing failed: " + e);
            return null;
        }

        if (ski != null) {
            return ski.getKeyIdentifier();
        } else {
            return null;
        }
    }
View Full Code Here

Examples of org.bouncycastle.asn1.x509.SubjectKeyIdentifier

            } else {
                // PublicKey key that don't encode to a ASN1Sequence. Fix this by creating a BC object instead.
                final PublicKey altKey = (PublicKey)KeyFactory.getInstance(pubKey.getAlgorithm(),"BC").translateKey(pubKey);
                keyASN1Sequence = (ASN1Sequence)new ASN1InputStream(new ByteArrayInputStream(altKey.getEncoded())).readObject();
            }
            return new SubjectKeyIdentifier(new SubjectPublicKeyInfo(keyASN1Sequence));
        } catch (Exception e) {
          final RuntimeException e2 = new RuntimeException("error creating key"); // NOPMD
          e2.initCause(e);
          throw e2;
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.