1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-12-22 19:08:00 +01:00

Use StandardCharsets.UTF_8

This commit is contained in:
Paul Schaub 2020-01-09 20:00:17 +01:00
parent 2e3a435d4e
commit e9b5e6278a
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -18,6 +18,7 @@ package org.pgpainless.key;
import javax.annotation.Nonnull;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import org.bouncycastle.openpgp.PGPPublicKey;
import org.bouncycastle.openpgp.PGPPublicKeyRing;
@ -48,7 +49,7 @@ public class OpenPgpV4Fingerprint implements CharSequence, Comparable<OpenPgpV4F
}
public OpenPgpV4Fingerprint(@Nonnull byte[] bytes) {
this(new String(bytes, Charset.forName("UTF-8")));
this(new String(bytes, StandardCharsets.UTF_8));
}
public OpenPgpV4Fingerprint(@Nonnull PGPPublicKey key) {
@ -87,7 +88,7 @@ public class OpenPgpV4Fingerprint implements CharSequence, Comparable<OpenPgpV4F
* @return key id
*/
public long getKeyId() {
byte[] bytes = Hex.decode(toString().getBytes(Charset.forName("UTF-8")));
byte[] bytes = Hex.decode(toString().getBytes(StandardCharsets.UTF_8));
ByteBuffer buf = ByteBuffer.wrap(bytes);
buf.position(12);
return buf.getLong();