public SubjectPublicKeyInfo( AlgorithmIdentifier algId, byte[] publicKey) { this.keyData = new DERBitString(publicKey); this.algId = algId; }
public NetscapeCertType( DERBitString usage) { super(usage.getBytes(), usage.getPadBits()); }
public static KeyUsage getInstance(Object obj) // needs to be DERBitString for other VMs { if (obj instanceof KeyUsage) { return (KeyUsage)obj; } else if (obj != null) { return new KeyUsage(DERBitString.getInstance(obj)); } return null; }
void encode( ASN1OutputStream out) throws IOException { byte[] string = derForm(data, padBits); byte[] bytes = new byte[string.length + 1]; bytes[0] = (byte)getPadBits(); System.arraycopy(string, 0, bytes, 1, bytes.length - 1); out.writeEncoded(BERTags.BIT_STRING, bytes); }
public byte[] getBytes() { return bitString.getBytes(); }
/** * @deprecated use JcaSignedPublicKeyAndChallenge.getPublicKey() */ public PublicKey getPublicKey(String provider) throws NoSuchAlgorithmException, NoSuchProviderException, InvalidKeyException { SubjectPublicKeyInfo subjectPKInfo = spkacSeq.getPublicKeyAndChallenge().getSubjectPublicKeyInfo(); try { DERBitString bStr = new DERBitString(subjectPKInfo); X509EncodedKeySpec xspec = new X509EncodedKeySpec(bStr.getOctets()); AlgorithmIdentifier keyAlg = subjectPKInfo.getAlgorithm(); KeyFactory factory = KeyFactory.getInstance(keyAlg.getAlgorithm().getId(),provider); return factory.generatePublic(xspec); } catch (Exception e) { throw new InvalidKeyException("error encoding public key"); } }
/** * Return the bytes making up the signature associated with this attribute certificate. * * @return the attribute certificate signature bytes. */ public byte[] getSignature() { return x509Certificate.getSignature().getOctets(); }
/** * return a Bit String from a tagged object. * * @param obj the tagged object holding the object we want * @param explicit true if the object is meant to be explicitly * tagged false otherwise. * @exception IllegalArgumentException if the tagged object cannot * be converted. */ public static DERBitString getInstance( ASN1TaggedObject obj, boolean explicit) { ASN1Primitive o = obj.getObject(); if (explicit || o instanceof DERBitString) { return getInstance(o); } else { return fromOctetString(((ASN1OctetString)o).getOctets()); } }
public int getPadBits() { return bitString.getPadBits(); }
public byte[] getSeed() { return this.seed.getBytes(); }
/** * Return the bytes making up the signature associated with this attribute certificate. * * @return the attribute certificate signature bytes. */ public byte[] getSignature() { return attrCert.getSignatureValue().getOctets(); }
/** * return a Bit String from a tagged object. * * @param obj the tagged object holding the object we want * @param explicit true if the object is meant to be explicitly * tagged false otherwise. * @exception IllegalArgumentException if the tagged object cannot * be converted. * @return a DERBitString instance, or null. */ public static DERBitString getInstance( ASN1TaggedObject obj, boolean explicit) { ASN1Primitive o = obj.getObject(); if (explicit || o instanceof DERBitString) { return getInstance(o); } else { return fromOctetString(((ASN1OctetString)o).getOctets()); } }
public ReasonFlags( DERBitString reasons) { super(reasons.getBytes(), reasons.getPadBits()); } }
public SubjectPublicKeyInfo( AlgorithmIdentifier algId, ASN1Encodable publicKey) { this.keyData = new DERBitString(publicKey); this.algId = algId; }
public String toString() { byte[] data = bitString.getBytes(); if (data.length == 1) { return "KeyUsage: 0x" + Integer.toHexString(data[0] & 0xff); } return "KeyUsage: 0x" + Integer.toHexString((data[1] & 0xff) << 8 | (data[0] & 0xff)); }
public DERBitString getSubjectPublicKey() { return DERBitString.getInstance(certificationRequestInfo.getSubjectPublicKeyInfo().getObjectAt(1)); }
/** * Return the bytes making up the signature associated with this request. * * @return the request signature bytes. */ public byte[] getSignature() { return certificationRequest.getSignature().getOctets(); }
public NetscapeCertType( DERBitString usage) { super(usage.getBytes(), usage.getPadBits()); }
/** * Basic constructor. * * @param usage - the bitwise OR of the Key Usage flags giving the * allowed uses for the key. * e.g. (KeyUsage.keyEncipherment | KeyUsage.dataEncipherment) */ public KeyUsage( int usage) { this.bitString = new DERBitString(usage); }
public byte[] getSignature() { return c.getSignature().getBytes(); }