Examples of ASN1Object


Examples of com.subgraph.orchid.crypto.ASN1Parser.ASN1Object

   */
  public RSAPublicKey parsePEMPublicKey(String pem) throws GeneralSecurityException {
    try {
      byte[] bs = decodeAsciiArmoredPEM(pem);
      ByteBuffer data = ByteBuffer.wrap(bs);
      final ASN1Object ob = asn1Parser.parseASN1(data);
      final List<ASN1Object> seq = asn1ObjectToSequence(ob, 2);
      final BigInteger modulus = asn1ObjectToBigInt(seq.get(0));
      final BigInteger exponent = asn1ObjectToBigInt(seq.get(1));
      return createKeyFromModulusAndExponent(modulus, exponent);
    } catch (IllegalArgumentException e) {
View Full Code Here

Examples of com.subgraph.orchid.crypto.ASN1Parser.ASN1Object

   * }
   *
   * See: http://www.jensign.com/JavaScience/dotnet/JKeyNet/index.html
   */
  private byte[] extractPKCS1KeyFromSubjectPublicKeyInfo(byte[] input) {
    final ASN1Object ob = asn1Parser.parseASN1(ByteBuffer.wrap(input));
    final List<ASN1Object> seq = asn1ObjectToSequence(ob, 2);
    return asn1ObjectToBitString(seq.get(1));
  }
View Full Code Here

Examples of org.apache.directory.api.asn1.Asn1Object

{

    @Override
    public void encode( IoSession session, Object message, ProtocolEncoderOutput out ) throws Exception
    {
        Asn1Object asn1Obj = ( Asn1Object ) message;
        boolean isTcp = !session.getTransportMetadata().isConnectionless();

        ByteBuffer encodedByteBuf = KerberosEncoder.encode( asn1Obj, isTcp );
        IoBuffer buf = IoBuffer.allocate( encodedByteBuf.remaining() );
        buf.put( encodedByteBuf.array() );
View Full Code Here

Examples of org.bouncycastle.asn1.ASN1Object

        // default for ordering
        ordering = ASN1Boolean.getInstance(false);
       
        while (e.hasMoreElements())
        {
            ASN1Object o = (ASN1Object) e.nextElement();

            if (o instanceof ASN1TaggedObject)
            {
                DERTaggedObject tagged = (DERTaggedObject) o;
View Full Code Here

Examples of org.bouncycastle.asn1.ASN1Object

                // try to parse the extension value byte[] to an ASN1 object
                byte[] extensionValueBin = certificate.getExtensionValue( oid );
                String extensionValue = null;
                try
                {
                    ASN1Object extension = X509ExtensionUtil.fromExtensionValue( extensionValueBin );
                    extensionValue = extension.toString();
                }
                catch ( IOException e )
                {
                    extensionValue = new String( Hex.encodeHex( extensionValueBin ) );
                }
View Full Code Here

Examples of org.bouncycastle.asn1.ASN1Object

                ASN1TaggedObject nobj = (ASN1TaggedObject) nseq.getObjectAt(1);
                // The name is yet another sequence of GeneralString
                ASN1Sequence sseq = ASN1Sequence.getInstance(nobj.getObject());
                Enumeration<ASN1Object> en = sseq.getObjects();
                while (en.hasMoreElements()) {
                  ASN1Object o = (ASN1Object)en.nextElement();
                    DERGeneralString str = DERGeneralString.getInstance(o);
                    if (ret != null) {
                      ret += "/"+str.getString();
                    } else {
                        ret = str.getString()
View Full Code Here

Examples of org.bouncycastle.asn1.ASN1Object

        DERTaggedObject taggedSpnego = new DERTaggedObject(0, seq);
       
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        ASN1OutputStream asn1Out = new ASN1OutputStream(out);

        ASN1Object spnegoOIDASN1 =  (ASN1Object) spnegoOid.toASN1Object();
        ASN1Object taggedSpnegoASN1    =    (ASN1Object) taggedSpnego.toASN1Object();
       
        int length = spnegoOIDASN1.getDEREncoded().length + taggedSpnegoASN1.getDEREncoded().length;
        byte [] lenBytes = writeLength(length);
        byte[] appWrap = new byte[lenBytes.length + 1];
       
        appWrap[0] = 0x60;
        for(int i=1; i < appWrap.length; i++){
View Full Code Here

Examples of org.bouncycastle.asn1.ASN1Object

                // try to parse the extension value byte[] to an ASN1 object
                byte[] extensionValueBin = certificate.getExtensionValue( oid );
                String extensionValue = null;
                try
                {
                    ASN1Object extension = X509ExtensionUtil.fromExtensionValue( extensionValueBin );
                    extensionValue = extension.toString();
                }
                catch ( IOException e )
                {
                    extensionValue = new String( Hex.encodeHex( extensionValueBin ) );
                }
View Full Code Here

Examples of org.bouncycastle.asn1.ASN1Object

        DERTaggedObject taggedSpnego = new DERTaggedObject(0, seq);

        ByteArrayOutputStream out = new ByteArrayOutputStream();
        ASN1OutputStream asn1Out = new ASN1OutputStream(out);

        ASN1Object spnegoOIDASN1 =  (ASN1Object) spnegoOid.toASN1Object();
        ASN1Object taggedSpnegoASN1    =    (ASN1Object) taggedSpnego.toASN1Object();

        int length = spnegoOIDASN1.getDEREncoded().length + taggedSpnegoASN1.getDEREncoded().length;
        byte [] lenBytes = writeLength(length);
        byte[] appWrap = new byte[lenBytes.length + 1];

        appWrap[0] = 0x60;
        for(int i=1; i < appWrap.length; i++){
View Full Code Here

Examples of org.bouncycastle.asn1.ASN1Object

        {
            Cipher              cipher;

            cipher =  CMSEnvelopedHelper.INSTANCE.getSymmetricCipher(encAlg, provider);
          
            ASN1Object sParams = (ASN1Object)_encAlg.getParameters();
   
            if (sParams != null && !(sParams instanceof ASN1Null))
            {
                AlgorithmParameters params = CMSEnvelopedHelper.INSTANCE.createAlgorithmParameters(encAlg, cipher.getProvider().getName());

                params.init(sParams.getEncoded(), "ASN.1");
   
                cipher.init(Cipher.DECRYPT_MODE, sKey, params);
            }
            else
            {
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.