Package com.subgraph.orchid.crypto.ASN1Parser

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


   * }
   *
   * 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

TOP

Related Classes of com.subgraph.orchid.crypto.ASN1Parser.ASN1Object

Copyright © 2018 www.massapicom. 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.