Home / Class/ Signed Class — netty Architecture

Signed Class — netty Architecture

Architecture documentation for the Signed class in Signed.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  b1f90d6b_16aa_bb9c_ea66_e5925cfae68a["Signed"]
  275c0f49_02c2_2b41_5e64_c82be60611ca["Signed.java"]
  b1f90d6b_16aa_bb9c_ea66_e5925cfae68a -->|defined in| 275c0f49_02c2_2b41_5e64_c82be60611ca
  ca0b54ef_40e9_fc36_e4d0_6562e7ac8ee7["Signed()"]
  b1f90d6b_16aa_bb9c_ea66_e5925cfae68a -->|method| ca0b54ef_40e9_fc36_e4d0_6562e7ac8ee7
  a64ae8fb_b477_7e1d_867a_8bb8765f6746["getEncoded()"]
  b1f90d6b_16aa_bb9c_ea66_e5925cfae68a -->|method| a64ae8fb_b477_7e1d_867a_8bb8765f6746
  cf6100f1_ac4f_2fae_6769_340f39f8f220["InputStream()"]
  b1f90d6b_16aa_bb9c_ea66_e5925cfae68a -->|method| cf6100f1_ac4f_2fae_6769_340f39f8f220

Relationship Graph

Source Code

pkitesting/src/main/java/io/netty/pkitesting/Signed.java lines 37–73

final class Signed {
    private final byte[] toBeSigned;
    private final String algorithmIdentifier;
    private final PrivateKey privateKey;

    Signed(byte[] toBeSigned, X509Bundle signer) {
        this(toBeSigned, signer.getCertificate().getSigAlgName(), signer.getKeyPair().getPrivate());
    }

    Signed(byte[] toBeSigned, String algorithmIdentifier, PrivateKey privateKey) {
        this.toBeSigned = Objects.requireNonNull(toBeSigned, "toBeSigned");
        this.algorithmIdentifier = Objects.requireNonNull(algorithmIdentifier, "algorithmIdentifier");
        this.privateKey = privateKey;
    }

    byte[] getEncoded(Provider provider) throws NoSuchAlgorithmException, InvalidKeyException, SignatureException {
        Signature signature = Algorithms.signature(algorithmIdentifier, provider);
        signature.initSign(privateKey);
        signature.update(toBeSigned);
        byte[] signatureBytes = signature.sign();
        try {
            return new DERSequence(new ASN1Encodable[]{
                    ASN1Primitive.fromByteArray(toBeSigned),
                    new AlgorithmIdentifier(new ASN1ObjectIdentifier(
                            Algorithms.oidForAlgorithmName(algorithmIdentifier))),
                    new DERBitString(signatureBytes)
            }).getEncoded("DER");
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        }
    }

    InputStream toInputStream(Provider provider)
            throws NoSuchAlgorithmException, SignatureException, InvalidKeyException {
        return new ByteArrayInputStream(getEncoded(provider));
    }
}

Frequently Asked Questions

What is the Signed class?
Signed is a class in the netty codebase, defined in pkitesting/src/main/java/io/netty/pkitesting/Signed.java.
Where is Signed defined?
Signed is defined in pkitesting/src/main/java/io/netty/pkitesting/Signed.java at line 37.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free