/** * Get the key identifier, which is composed of the 160-bit SHA-1 hash of the value of the BIT STRING * {@code subjectPublicKey} (excluding the tag, length, and number of unused bits), as per * <a href="https://tools.ietf.org/html/rfc3280">RFC 3280</a>. * * @param publicKey the public key * @return the key identifier */ public static byte[] getKeyIdentifier(final PublicKey publicKey) { DERDecoder decoder = new DERDecoder(publicKey.getEncoded()); decoder.startSequence(); decoder.skipElement(); // skip the algorithm byte[] subjectPublicKey = decoder.decodeBitString(); decoder.endSequence(); final MessageDigest messageDigest; try { messageDigest = MessageDigest.getInstance("SHA-1"); messageDigest.update(subjectPublicKey); return messageDigest.digest(); } catch (NoSuchAlgorithmException e) { throw new IllegalStateException(e); } } }
@Override public BigInteger decodeBitStringAsInteger() { DERDecoder decoder = new DERDecoder(decodeBitString()); if (decoder.peekType() != INTEGER_TYPE) { throw log.asnUnexpectedTag(); } return decoder.decodeInteger(); }
byte[] serverSignature = decoder.decodeBitString(); decoder.endSequence();
byte[] clientSignature = decoder.decodeBitString(); decoder.endSequence();
/** * Get the key identifier, which is composed of the 160-bit SHA-1 hash of the value of the BIT STRING * {@code subjectPublicKey} (excluding the tag, length, and number of unused bits), as per * <a href="https://tools.ietf.org/html/rfc3280">RFC 3280</a>. * * @param publicKey the public key * @return the key identifier */ public static byte[] getKeyIdentifier(final PublicKey publicKey) { DERDecoder decoder = new DERDecoder(publicKey.getEncoded()); decoder.startSequence(); decoder.skipElement(); // skip the algorithm byte[] subjectPublicKey = decoder.decodeBitString(); decoder.endSequence(); final MessageDigest messageDigest; try { messageDigest = MessageDigest.getInstance("SHA-1"); messageDigest.update(subjectPublicKey); return messageDigest.digest(); } catch (NoSuchAlgorithmException e) { throw new IllegalStateException(e); } } }
/** * Get the key identifier, which is composed of the 160-bit SHA-1 hash of the value of the BIT STRING * {@code subjectPublicKey} (excluding the tag, length, and number of unused bits), as per * <a href="https://tools.ietf.org/html/rfc3280">RFC 3280</a>. * * @param publicKey the public key * @return the key identifier */ public static byte[] getKeyIdentifier(final PublicKey publicKey) { DERDecoder decoder = new DERDecoder(publicKey.getEncoded()); decoder.startSequence(); decoder.skipElement(); // skip the algorithm byte[] subjectPublicKey = decoder.decodeBitString(); decoder.endSequence(); final MessageDigest messageDigest; try { messageDigest = MessageDigest.getInstance("SHA-1"); messageDigest.update(subjectPublicKey); return messageDigest.digest(); } catch (NoSuchAlgorithmException e) { throw new IllegalStateException(e); } } }
/** * Get the key identifier, which is composed of the 160-bit SHA-1 hash of the value of the BIT STRING * {@code subjectPublicKey} (excluding the tag, length, and number of unused bits), as per * <a href="https://tools.ietf.org/html/rfc3280">RFC 3280</a>. * * @param publicKey the public key * @return the key identifier */ public static byte[] getKeyIdentifier(final PublicKey publicKey) { DERDecoder decoder = new DERDecoder(publicKey.getEncoded()); decoder.startSequence(); decoder.skipElement(); // skip the algorithm byte[] subjectPublicKey = decoder.decodeBitString(); decoder.endSequence(); final MessageDigest messageDigest; try { messageDigest = MessageDigest.getInstance("SHA-1"); messageDigest.update(subjectPublicKey); return messageDigest.digest(); } catch (NoSuchAlgorithmException e) { throw new IllegalStateException(e); } } }
@Override public BigInteger decodeBitStringAsInteger() { DERDecoder decoder = new DERDecoder(decodeBitString()); if (decoder.peekType() != INTEGER_TYPE) { throw log.asnUnexpectedTag(); } return decoder.decodeInteger(); }
@Override public BigInteger decodeBitStringAsInteger() { DERDecoder decoder = new DERDecoder(decodeBitString()); if (decoder.peekType() != INTEGER_TYPE) { throw log.asnUnexpectedTag(); } return decoder.decodeInteger(); }
@Override public BigInteger decodeBitStringAsInteger() { DERDecoder decoder = new DERDecoder(decodeBitString()); if (decoder.peekType() != INTEGER_TYPE) { throw log.asnUnexpectedTag(); } return decoder.decodeInteger(); }
byte[] serverSignature = decoder.decodeBitString(); decoder.endSequence();
byte[] serverSignature = decoder.decodeBitString(); decoder.endSequence();
byte[] serverSignature = decoder.decodeBitString(); decoder.endSequence();
byte[] clientSignature = decoder.decodeBitString(); decoder.endSequence();
byte[] clientSignature = decoder.decodeBitString(); decoder.endSequence();
byte[] clientSignature = decoder.decodeBitString(); decoder.endSequence();