public EncryptedObjectStoreData(AlgorithmIdentifier encryptionAlgorithm, byte[] encryptedContent) { this.encryptionAlgorithm = encryptionAlgorithm; this.encryptedContent = new DEROctetString(encryptedContent); }
/** * convert a vector of octet strings into a single byte string */ static private byte[] toBytes( Vector octs) { ByteArrayOutputStream bOut = new ByteArrayOutputStream(); for (int i = 0; i != octs.size(); i++) { try { DEROctetString o = (DEROctetString)octs.elementAt(i); bOut.write(o.getOctets()); } catch (ClassCastException e) { throw new IllegalArgumentException(octs.elementAt(i).getClass().getName() + " found in input should only contain DEROctetString"); } catch (IOException e) { throw new IllegalArgumentException("exception converting octets " + e.toString()); } } return bOut.toByteArray(); }
private static byte[] getEncodedSubKeyId(byte[] subjectKeyIdentifier) { try { return new DEROctetString(subjectKeyIdentifier).getEncoded(); } catch (final IOException e) { throw new IllegalArgumentException("Cannot process subject key identifier: " + e.getMessage()) { public Throwable getCause() { return e; } }; } }
.getInstance(new ASN1InputStream( ((DEROctetString) DEROctetString .fromByteArray(targetInfoExt)).getOctets()) .readObject());
private XMSSMTPublicKey(ASN1Sequence seq) { if (!ASN1Integer.getInstance(seq.getObjectAt(0)).getValue().equals(BigInteger.valueOf(0))) { throw new IllegalArgumentException("unknown version of sequence"); } this.publicSeed = Arrays.clone(DEROctetString.getInstance(seq.getObjectAt(1)).getOctets()); this.root = Arrays.clone(DEROctetString.getInstance(seq.getObjectAt(2)).getOctets()); }
public void write( int b) throws IOException { _buf[_off++] = (byte)b; if (_off == _buf.length) { DEROctetString.encode(_derOut, _buf); _off = 0; } }
.getInstance(new ASN1InputStream( ((DEROctetString) DEROctetString .fromByteArray(targetInfoExt)).getOctets()) .readObject());
private XMSSPublicKey(ASN1Sequence seq) { if (!ASN1Integer.getInstance(seq.getObjectAt(0)).getValue().equals(BigInteger.valueOf(0))) { throw new IllegalArgumentException("unknown version of sequence"); } this.publicSeed = Arrays.clone(DEROctetString.getInstance(seq.getObjectAt(1)).getOctets()); this.root = Arrays.clone(DEROctetString.getInstance(seq.getObjectAt(2)).getOctets()); }
public void write( int b) throws IOException { _buf[_off++] = (byte)b; if (_off == _buf.length) { DEROctetString.encode(_derOut, _buf); _off = 0; } }
public RecipientKeyIdentifier( byte[] subjectKeyIdentifier, DERGeneralizedTime date, OtherKeyAttribute other) { this.subjectKeyIdentifier = new DEROctetString(subjectKeyIdentifier); this.date = date; this.other = other; }
private static byte[] getEncodedSubKeyId(byte[] subjectKeyIdentifier) { try { return new DEROctetString(subjectKeyIdentifier).getEncoded(); } catch (final IOException e) { throw new IllegalArgumentException("Cannot process subject key identifier: " + e.getMessage()) { public Throwable getCause() { return e; } }; } }
/** * Convert a vector of octet strings into a single byte string */ static private byte[] toBytes( ASN1OctetString[] octs) { ByteArrayOutputStream bOut = new ByteArrayOutputStream(); for (int i = 0; i != octs.length; i++) { try { DEROctetString o = (DEROctetString)octs[i]; bOut.write(o.getOctets()); } catch (ClassCastException e) { throw new IllegalArgumentException(octs[i].getClass().getName() + " found in input should only contain DEROctetString"); } catch (IOException e) { throw new IllegalArgumentException("exception converting octets " + e.toString()); } } return bOut.toByteArray(); }
public SignerInfo( ASN1Sequence seq) { Enumeration e = seq.getObjects(); version = (ASN1Integer)e.nextElement(); issuerAndSerialNumber = IssuerAndSerialNumber.getInstance(e.nextElement()); digAlgorithm = AlgorithmIdentifier.getInstance(e.nextElement()); Object obj = e.nextElement(); if (obj instanceof ASN1TaggedObject) { authenticatedAttributes = ASN1Set.getInstance((ASN1TaggedObject)obj, false); digEncryptionAlgorithm = AlgorithmIdentifier.getInstance(e.nextElement()); } else { authenticatedAttributes = null; digEncryptionAlgorithm = AlgorithmIdentifier.getInstance(obj); } encryptedDigest = DEROctetString.getInstance(e.nextElement()); if (e.hasMoreElements()) { unauthenticatedAttributes = ASN1Set.getInstance((ASN1TaggedObject)e.nextElement(), false); } else { unauthenticatedAttributes = null; } }
public void write(byte[] b, int off, int len) throws IOException { while (len > 0) { int numToCopy = Math.min(len, _buf.length - _off); System.arraycopy(b, off, _buf, _off, numToCopy); _off += numToCopy; if (_off < _buf.length) { break; } DEROctetString.encode(_derOut, _buf); _off = 0; off += numToCopy; len -= numToCopy; } }
public EncryptedPrivateKeyInfo( AlgorithmIdentifier algId, byte[] encoding) { this.algId = algId; this.data = new DEROctetString(encoding); }
protected byte[] engineGetEncoded( String format) throws IOException { if (isASN1FormatString(format)) { return new DEROctetString(engineGetEncoded("RAW")).getEncoded(); } if (format.equals("RAW")) { return Arrays.clone(iv); } return null; }
/** * convert a vector of octet strings into a single byte string */ static private byte[] toBytes( ASN1OctetString[] octs) { ByteArrayOutputStream bOut = new ByteArrayOutputStream(); for (int i = 0; i != octs.length; i++) { try { DEROctetString o = (DEROctetString)octs[i]; bOut.write(o.getOctets()); } catch (ClassCastException e) { throw new IllegalArgumentException(octs[i].getClass().getName() + " found in input should only contain DEROctetString"); } catch (IOException e) { throw new IllegalArgumentException("exception converting octets " + e.toString()); } } return bOut.toByteArray(); }
public SignerInfo( ASN1Sequence seq) { Enumeration e = seq.getObjects(); version = (ASN1Integer)e.nextElement(); issuerAndSerialNumber = IssuerAndSerialNumber.getInstance(e.nextElement()); digAlgorithm = AlgorithmIdentifier.getInstance(e.nextElement()); Object obj = e.nextElement(); if (obj instanceof ASN1TaggedObject) { authenticatedAttributes = ASN1Set.getInstance((ASN1TaggedObject)obj, false); digEncryptionAlgorithm = AlgorithmIdentifier.getInstance(e.nextElement()); } else { authenticatedAttributes = null; digEncryptionAlgorithm = AlgorithmIdentifier.getInstance(obj); } encryptedDigest = DEROctetString.getInstance(e.nextElement()); if (e.hasMoreElements()) { unauthenticatedAttributes = ASN1Set.getInstance((ASN1TaggedObject)e.nextElement(), false); } else { unauthenticatedAttributes = null; } }
public void write(byte[] b, int off, int len) throws IOException { while (len > 0) { int numToCopy = Math.min(len, _buf.length - _off); System.arraycopy(b, off, _buf, _off, numToCopy); _off += numToCopy; if (_off < _buf.length) { break; } DEROctetString.encode(_derOut, _buf); _off = 0; off += numToCopy; len -= numToCopy; } }
public IDEACBCPar( byte[] iv) { this.iv = new DEROctetString(iv); }